Skip to main content

FpcPredictor

Trait FpcPredictor 

Source
pub trait FpcPredictor {
    // Required methods
    fn fpca_mean(&self) -> &[f64];
    fn fpca_rotation(&self) -> &FdMatrix;
    fn ncomp(&self) -> usize;
    fn training_scores(&self) -> &FdMatrix;
    fn task_type(&self) -> TaskType;
    fn predict_from_scores(
        &self,
        scores: &[f64],
        scalar_covariates: Option<&[f64]>,
    ) -> f64;

    // Provided method
    fn project(&self, data: &FdMatrix) -> FdMatrix { ... }
}
Expand description

Trait abstracting over any FPC-based model for generic explainability.

Implement this for a model that projects functional data onto FPC scores and produces a scalar prediction (value, probability, or class label).

Required Methods§

Source

fn fpca_mean(&self) -> &[f64]

Mean function from FPCA (length m).

Source

fn fpca_rotation(&self) -> &FdMatrix

Rotation matrix from FPCA (m × ncomp).

Source

fn ncomp(&self) -> usize

Number of FPC components used.

Source

fn training_scores(&self) -> &FdMatrix

Training FPC scores matrix (n × ncomp).

Source

fn task_type(&self) -> TaskType

What kind of prediction task this model solves.

Source

fn predict_from_scores( &self, scores: &[f64], scalar_covariates: Option<&[f64]>, ) -> f64

Predict from FPC scores + optional scalar covariates → single f64.

  • Regression: predicted value
  • Binary classification: P(Y=1)
  • Multiclass: predicted class label as f64

Provided Methods§

Source

fn project(&self, data: &FdMatrix) -> FdMatrix

Project functional data to FPC scores.

Implementors§