PcaEstimateDecoder¶
- class PcaEstimateDecoder(explained_variance=0.8, clf=SVC(), clf_params=None)[source][source]¶
Class for the PCA - SVM Classifier
- Parameters:
explained_variance (
float, optional, default0.8) – the cumulative explained variance ratio required for PCAclf (
object, optional, defaultSVC()) – the classifier object to use for classificationclf_params (
dict, optional) – Additional parameters to be passed to the classifier (e.g., {‘param_name’: value})
- fit(X_flat_train, y_train)[source][source]¶
Train PCA - SVM 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
- predict(X_flat_test)[source][source]¶
Predict outcomes using trained PCA - SVM 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.
- 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$') PcaEstimateDecoder[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 (PcaEstimateDecoder)
- Returns:
self – The updated object.
- Return type:
- set_predict_request(*, X_flat_test: bool | None | str = '$UNCHANGED$') PcaEstimateDecoder[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$') PcaEstimateDecoder[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.