FAME3RVectorizer#
- class fame3r.FAME3RVectorizer(*, radius: int = 5, input: Literal['smiles', 'cdpkit'] = 'smiles', output: list[Literal['fingerprint', 'counts', 'physicochemical', 'topological']] = ['fingerprint', 'physicochemical', 'topological'])[source]#
Transforms atom environments into FAME3-like features.
- Parameters:
- radiusint, default=5
Radius used for circular fingerprint generation.
- input{“smiles”, “cdpkit”}, default=”smiles”
Format of the provided atoms and their environment. Can be either “smiles” to accept SMILES codes with a single atom mapping number each specifying the atom used to generate descriptors, or “cdpkit” to accept CDPKit Atom objects.
- outputlist of {“fingerprint”, “counts”, “physicochemical”, “topological”}
Which molecular descriptors to generate, and in which order. Defaults to generating the “fingerprint”, “physicochemical” and “topological” descriptors, in that order.
The “counts” descriptors are an alternative to of the “fingerprints” descriptors which use integers for representing counts instead of the 32-bit encoding used in the original version of the FAME3 software.
Examples
>>> from fame3r import FAME3RVectorizer >>> FAME3RVectorizer().fit_transform([["CC[C:1]"]]) array([[1., 0., 0., ..., 2., 0., 1.]], shape=(1, 5006))
- fit(X=None, y=None)[source]#
Set up the vectorizer for usage.
- Parameters:
- X(ignored)
Ignored parameter.
- y(ignored)
Ignored parameter.
- Returns:
- selfobject
FAME3RVectorizer class instance.
- transform(X)[source]#
Transform atom environments to feature matrix.
Samples are provided as a 2d array with shape (n_samples, 1).
The single provided feature should either be a SMILES string or a CPDKit Atom, depending on the value of
inputgiven to the constructor.- Parameters:
- Xarray-like of shape (n_samples, 1)
Input samples.
- Returns:
- X_newndarray array of shape (n_samples, n_features_new)
Transformed array.
- transform_one(X) ndarray[tuple[Any, ...], dtype[floating]][source]#
Transform a single atom environment to feature vector.
The sample is provided as an 1d array with shape (1,).
The single provided feature should either be a SMILES string or a CPDKit Atom, depending on the value of
inputgiven to the constructor.- Parameters:
- Xarray-like of shape (1,)
Input sample.
- Returns:
- X_newndarray array of shape (n_features_new,)
Feature vector.
- 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.
- fit_transform(X, y=None, **fit_params)#
Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
- Parameters:
- Xarray-like of shape (n_samples, n_features)
Input samples.
- yarray-like of shape (n_samples,) or (n_samples, n_outputs), default=None
Target values (None for unsupervised transformations).
- **fit_paramsdict
Additional fit parameters.
- Returns:
- X_newndarray array of shape (n_samples, n_features_new)
Transformed array.
- 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.