FAME3RScoreEstimator#
- class fame3r.FAME3RScoreEstimator(n_neighbors: int = 3)[source]#
Computes the FAME score for a set of features.
The FAME score is defined as the mean Tanimoto similarity of the feature vector to the
nclosest vectors in the training set.It is intended for this estimator to only be used with binary feature (“fingerprint”) vectors, as Tanimoto similarity is not well-behaved on arbitrary vectors.
- Parameters:
- n_neighborsint, default=3
Number of nearest neigbors to consider during FAME score calculation. Defaults to 3, as defined in the original paper.
Examples
>>> from fame3r import FAME3RVectorizer, FAME3RScoreEstimator >>> from sklearn.pipeline import make_pipeline >>> pipeline = make_pipeline( >>> FAME3RVectorizer(output=["fingerprint"]), >>> FAME3RScoreEstimator() >>> ).fit([["CC[C:1]"], ["CC[N:1]"], ["CC[O:1]"]]) >>> pipeline.predict([["[C:1]CC"]]) array([0.66666667])
- fit(X, y=None)[source]#
Fit the estimator to the training set of known samples.
- Parameters:
- X{array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
- y(ignored)
Not used, present for API consistency by convention.
- Returns:
- selfobject
FAME3RVectorizer class instance.
- predict(X)[source]#
Compute the FAME score of the given samples.
- Parameters:
- X{array-like, sparse matrix} of shape (n_samples, n_features)
Query data.
- Returns:
- yndarray of shape (n_samples,)
The predicted FAME scores.
- get_feature_names_out(input_features=None)[source]#
Get output feature names for transformation.
- Parameters:
- input_featuresarray-like of str or None, default=None
Not used, present here for API consistency by convention.
- Returns:
- feature_names_outndarray of str objects
Transformed feature names.
- get_metadata_routing()#
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)#
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_output(*, transform=None)#
Set output container.
See Introducing the set_output API for an example on how to use the API.
- Parameters:
- transform{“default”, “pandas”, “polars”}, default=None
Configure output of transform and fit_transform.
“default”: Default output format of a transformer
“pandas”: DataFrame output
“polars”: Polars output
None: Transform configuration is unchanged
Added in version 1.4: “polars” option was added.
- Returns:
- selfestimator instance
Estimator instance.
- set_params(**params)#
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.