PcaLdaClassification¶
- class PcaLdaClassification(explained_variance=0.8, da_type='lda', PCA_kwargs={'n_components': 0.8}, DA_kwargs={})[source][source]¶
Class for the PCA - LDA Classifier
- Parameters:
variance (explained) – the number of modes that explain the cumulative variance of the dataset
da_type (
string, optional, defaultlda) – type of discriminant analysis; lda or qda
- fit(X_flat_train, y_train)[source][source]¶
Train PCA - LDA classifier
- Parameters:
X_flat_train (
numpy 2d arrayofshape [n_samples,n_features]) – This is the neural data. See example file for an example of how to format the neural data correctlyy_train (
numpy 1d arrayofshape (n_samples),with integers)classes (representing) – This is the outputs that are being predicted
- get_scores(deep=True)[source][source]¶
Get scores of pca and lda model
- Args:
deep (bool, optional): Defaults to True.
- Returns:
scores: dict Returns fitted scores of PCA and LDA
- predict(X_flat_test)[source][source]¶
Predict outcomes using trained PCA LDA Decoder
- Parameters:
X_flat_test (
numpy 2d arrayofshape [n_samples,n_features]) – This is the neural data being used to predict outputs.- Returns:
y_test_predicted – The predicted outputs
- Return type:
numpy 1d array with integers as classes
- score(X, y, sample_weight=None)[source][source]¶
Returns the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
- Parameters:
X (
array-like,shape = (n_samples,n_features)) – Test samples.y (
array-like,shape = (n_samples)or(n_samples,n_outputs)) – True labels for X.sample_weight (
array-like,shape = [n_samples], optional) – Sample weights.
- Returns:
score – Mean accuracy of self.predict(X) wrt. y.
- Return type:
- set_fit_request(*, X_flat_train: bool | None | str = '$UNCHANGED$', y_train: bool | None | str = '$UNCHANGED$') PcaLdaClassification[source]¶
Request metadata passed to the
fitmethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline. Otherwise it has no effect.- Parameters:
X_flat_train (
str,True,False, orNone, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing forX_flat_trainparameter infit.y_train (
str,True,False, orNone, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing fory_trainparameter infit.self (PcaLdaClassification)
- Returns:
self – The updated object.
- Return type:
- set_predict_request(*, X_flat_test: bool | None | str = '$UNCHANGED$') PcaLdaClassification[source]¶
Request metadata passed to the
predictmethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline. Otherwise it has no effect.
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') PcaLdaClassification[source]¶
Request metadata passed to the
scoremethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline. Otherwise it has no effect.