Elastic Principal Component Regression#
Warping Invariant PCR Regression using SRSF
moduleauthor:: J. Derek Tucker <jdtuck@sandia.gov>
- class pcr_regression.elastic_lpcr_regression(f, y, time)[source]#
This class provides elastic logistic pcr regression for functional data using the SRVF framework accounting for warping
Usage: obj = elastic_lpcr_regression(f,y,time)
- Parameters:
f – (M,N) % matrix defining N functions of M samples
y – response vector of length N (-1/1)
warp_data – fdawarp object of alignment
pca – class dependent on fPCA method used object of fPCA
information –
alpha – intercept
b – coefficient vector
Loss – logistic loss
PC – probability of classification
ylabels – predicted labels
Author : J. D. Tucker (JDT) <jdtuck AT sandia.gov> Date : 18-Mar-2018
- calc_model(pca_method='combined', no=5, smooth_data=False, sparam=25, parallel=False)[source]#
This function identifies a logistic regression model with phase-variability using elastic pca
- Parameters:
pca_method – string specifying pca method (options = “combined”, “vert”, or “horiz”, default = “combined”)
no – scalar specify number of principal components (default=5)
smooth_data – smooth data using box filter (default = F)
sparam – number of times to apply box filter (default = 25)
parallel – calculate in parallel (default = F)
- predict(newdata=None)[source]#
This function performs prediction on regression model on new data if available or current stored data in object Usage: obj.predict(newdata)
- Parameters:
newdata (dict) – dict containing new data for prediction (needs the keys below, if None predicts on training data)
f – (M,N) matrix of functions
time – vector of time points
y – truth if available
smooth – smooth data if needed
sparam – number of times to run filter
- class pcr_regression.elastic_mlpcr_regression(f, y, time)[source]#
This class provides elastic multinomial logistic pcr regression for functional data using the SRVF framework accounting for warping
Usage: obj = elastic_mlpcr_regression(f,y,time)
- Parameters:
f – (M,N) % matrix defining N functions of M samples
y – response vector of length N
Y – coded label matrix
warp_data – fdawarp object of alignment
pca – class dependent on fPCA method used object of fPCA
information –
alpha – intercept
b – coefficient vector
Loss – logistic loss
PC – probability of classification
ylabels – predicted labels
Author : J. D. Tucker (JDT) <jdtuck AT sandia.gov> Date : 18-Mar-2018
- calc_model(pca_method='combined', no=5, smooth_data=False, sparam=25, parallel=False)[source]#
This function identifies a logistic regression model with phase-variability using elastic pca
- Parameters:
f (np.ndarray) – numpy ndarray of shape (M,N) of N functions with M samples
y – numpy array of N responses
time (np.ndarray) – vector of size M describing the sample points
pca_method – string specifying pca method (options = “combined”, “vert”, or “horiz”, default = “combined”)
no – scalar specify number of principal components (default=5)
smooth_data – smooth data using box filter (default = F)
sparam – number of times to apply box filter (default = 25)
parallel – run model in parallel (default = F)
- predict(newdata=None)[source]#
This function performs prediction on regression model on new data if available or current stored data in object Usage: obj.predict(newdata)
- Parameters:
newdata (dict) – dict containing new data for prediction (needs the keys below, if None predicts on training data)
f – (M,N) matrix of functions
time – vector of time points
y – truth if available
smooth – smooth data if needed
sparam – number of times to run filter
- class pcr_regression.elastic_pcr_regression(f, y, time)[source]#
This class provides elastic pcr regression for functional data using the SRVF framework accounting for warping
Usage: obj = elastic_pcr_regression(f,y,time)
- Parameters:
f – (M,N) % matrix defining N functions of M samples
y – response vector of length N
warp_data – fdawarp object of alignment
pca – class dependent on fPCA method used object of fPCA
alpha – intercept
b – coefficient vector
SSE – sum of squared errors
Author : J. D. Tucker (JDT) <jdtuck AT sandia.gov> Date : 18-Mar-2018
- calc_model(pca_method='combined', no=5, var_exp=None, smooth_data=False, sparam=25, parallel=False, C=None)[source]#
This function identifies a regression model with phase-variability using elastic pca
- Parameters:
pca_method – string specifying pca method (options = “combined”, “vert”, or “horiz”, default = “combined”)
no – scalar specify number of principal components (default=5)
var_exp – compute no based on value percent variance explained (example: 0.95)
smooth_data – smooth data using box filter (default = F)
sparam – number of times to apply box filter (default = 25)
parallel – run in parallel (default = F)
C – scale balance parameter for combined method (default = None)
- predict(newdata=None, alpha=0.05)[source]#
This function performs prediction on regression model on new data if available or current stored data in object Usage: obj.predict(newdata)
- Parameters:
newdata (dict) – dict containing new data for prediction (needs the keys below, if None predicts on training data)
f – (M,N) matrix of functions
time – vector of time points
y – truth if available
smooth – smooth data if needed
sparam – number of times to run filter