Types
CPPLS relies on two main custom types in the StatsAPI.fit and StatsAPI.predict workflow. CPPLSModel stores the user-controlled model specification, including the number of components, the gamma configuration, centering, the analysis mode, and numerical tolerances. CPPLSFit is the full fitted model returned by fit; it contains regression coefficients, scores, labels, and other quantities needed for prediction, diagnostics, and plotting. A third container, CPPLSFitLight, stores only the subset of fitted-model information needed for cross-validation. It is an internal optimization and is typically not accessed directly by users.
The package provides getters for fields that are commonly useful in downstream work. For CPPLSModel, the getters are gamma, mode, and ncomponents. For CPPLSFit, the getters are coef, mode, fitted, gamma, gammas, rhos, predictorlabels, responselabels, residuals, sampleclasses, samplelabels, and xscores.
Both container types contain additional named fields of possible interest. You can inspect them with propertynames(spec) or propertynames(model) and access them directly via dot notation, for example spec.X_loading_weight_tolerance.
CPPLSModel
CPPLS.CPPLSModel — Type
CPPLSModel{T}Model specification passed to fit. A CPPLSModel stores the user-controlled settings for CPPLS fitting, most importantly ncomponents, gamma, centering and scaling of predictor and response variables, and mode.
CPPLS.gamma — Method
gamma(model::CPPLSModel)Return the gamma requested in the model.
CPPLS.mode — Method
mode(model::CPPLSModel)Return the analysis mode requested in the model.
CPPLS.ncomponents — Method
ncomponents(model::CPPLSModel)Return the number of components requested in the model.
AbstractCPPLSFit
CPPLS.AbstractCPPLSFit — Type
AbstractCPPLSFitCommon supertype for fitted CPPLS models that share the fields B, Xbar, Ybar, and mode.
StatsAPI.coef — Method
coef(fit::AbstractCPPLSFit)
coef(fit::AbstractCPPLSFit, ncomponents::Integer)Return the regression coefficient matrix for the final (or requested) number of components.
CPPLS.coefall — Method
coefall(fit::AbstractCPPLSFit)Return the regression coefficients for the fitted model.
CPPLSFit
CPPLS.CPPLSFit — Type
CPPLSFit{T1, T2}Full fitted CPPLS model returned by fit. This type stores regression coefficients together with the intermediate quantities needed for diagnostics, projections, and plotting.
Most users will work with a CPPLSFit through predict, project, coef, fitted, residuals, xscores, and the various label getters rather than by accessing fields directly.
StatsAPI.fitted — Method
fitted(fit::CPPLSFit)
fitted(fit::CPPLSFit, ncomponents::Integer)Return the fitted response matrix for the final (or requested) number of components.
CPPLS.gamma — Method
gamma(fit::CPPLSFit)Return the power-parameter values selected during fitting.
CPPLS.gammas — Method
gammas(fit::CPPLSFit)
gammas(fit::CPPLSFit, latent_variable::Integer)Return the matrix of per-candidate gamma values considered during fitting, or the column for a specific latent variable.
CPPLS.mode — Method
mode(fit::CPPLSFit)Return the analysis mode for the fitted model.
CPPLS.predictorlabels — Method
predictorlabels(fit::CPPLSFit)Return the stored predictor labels for the fitted model.
CPPLS.projectionmatrix — Method
projectionmatrix(fit::CPPLSFit)Return the projection matrix R for the fitted model.
StatsAPI.residuals — Method
residuals(fit::CPPLSFit)
residuals(fit::CPPLSFit, ncomponents::Integer)Return the response residual matrix for the final (or requested) number of components.
CPPLS.responselabels — Method
responselabels(fit::CPPLSFit)Return the response labels (response names or class names) for the fitted model.
CPPLS.rhos — Method
rhos(fit::CPPLSFit)
rhos(fit::CPPLSFit, latent_variable::Integer)Return the matrix of per-candidate squared canonical correlations considered during fitting, or the column for a specific latent variable.
CPPLS.sampleclasses — Method
sampleclasses(fit::CPPLSFit)Return the per-sample class labels stored for discriminant analysis models, or nothing for regression fits.
CPPLS.samplelabels — Method
samplelabels(fit::CPPLSFit)Return the stored sample labels for the fitted model.
CPPLS.xscores — Method
xscores(fit::CPPLSFit)
xscores(fit::CPPLSFit, comp::Integer)
xscores(fit::CPPLSFit, comps::AbstractUnitRange{<:Integer})
xscores(fit::CPPLSFit, comps::AbstractVector{<:Integer})Return the predictor score matrix T for the fitted model, or a subset of its columns:
xscores(fit)returns the full score matrix (all components).xscores(fit, comp)returns the column for a single component as a vector.xscores(fit, comps::AbstractUnitRange)returns a matrix with the selected range of components.xscores(fit, comps::AbstractVector)returns a matrix with the specified components (in given order).
Throws an error if any requested component index is out of bounds.
CPPLSFitLight
CPPLS.CPPLSFitLight — Type
CPPLSFitLight{T}Reduced fitted CPPLS model that retains only the information needed for prediction. This type is used mainly for efficient internal prediction during cross-validation.
Most users will work with CPPLSFit instead.