skkda.base module#
Scikit-learn-compatible Kernel Discriminant Analysis.
Used in David Diaz-Vico, Jose R. Dorronsoro “Deep vs Kernel Fisher Discriminant Analysis”
Based on algorithm 5 in Zhihua Zhang, Guang Dai, Congfu Xu, Michael I. Jordan “Regularized Discriminant Analysis, Ridge Regression and Beyond” http://www.jmlr.org/papers/v11/zhang10b.html
@author: David Diaz Vico @license: MIT
- class skkda.base.KernelDiscriminantAnalysis(lmb=0.001, kernel='rbf', degree=3, gamma=None, coef0=1)[source]#
Bases:
BaseEstimator,ClassifierMixin,TransformerMixinKernel Discriminant Analysis.
- Parameters:
lmb (float (>= 0.0), default=0.001) – Regularization parameter
kernel ({"chi2", "laplacian", "linear", "polynomial", "rbf", "sigmoid"},) – default=’rbf’ Kernel.
degree (integer, default=3)
gamma (float, default=None)
coef0 (integer, default=1)
- fit(X, y)[source]#
Fit KFDA model.
- Parameters:
X (numpy array of shape [n_samples, n_features]) – Training set.
y (numpy array of shape [n_samples]) – Target values. Only works for 2 classes.
- Return type:
self
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') KernelDiscriminantAnalysis#
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the 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.
- Parameters:
sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
sample_weightparameter inscore.- Returns:
self – The updated object.
- Return type:
object