KDEyCS#
- class mlquantify.neighbors.KDEyCS(learner=None, bandwidth: float = 0.1, kernel: str = 'gaussian')[source]#
KDEy Cauchy-Schwarz Divergence quantifier.
Uses a closed-form solution for minimizing the Cauchy-Schwarz (CS) divergence between Gaussian Mixture Models representing class-conditional densities fitted via KDE.
This mathematically efficient approach leverages precomputed kernel Gram matrices of train-train, train-test, and test-test instances for fast divergence evaluation, enabling scalable multiclass quantification.
References
Based on closed-form CS divergence derivations by Kampa et al. (2011) and KDEy density representations, as discussed by Moreo et al. (2023).
- best_distance(predictions, train_predictions, train_y_values)[source]#
Retorna a melhor distância encontrada durante o ajuste.
- get_metadata_routing()[source]#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequestencapsulating routing information.
- get_params(deep=True)[source]#
Get parameters for this estimator.
- Parameters:
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
- paramsdict
Parameter names mapped to their values.
- set_fit_request(*, learner_fitted: bool | None | str = '$UNCHANGED$') KDEyCS[source]#
Configure whether metadata should be requested to be passed to the
fitmethod.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 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.
- Parameters:
- learner_fittedstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
learner_fittedparameter infit.
- Returns:
- selfobject
The updated object.
- set_params(**params)[source]#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline). The latter have parameters of the form<component>__<parameter>so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
Estimator parameters.
- Returns:
- selfestimator instance
Estimator instance.