schrodinger.application.matsci.mlearn.base module¶
Classes and functions to deal with ML features.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.matsci.mlearn.base.
BaseFeaturizer
[source]¶ Bases:
sklearn.base.BaseEstimator
,sklearn.base.TransformerMixin
Class that MUST be inherited to create sklearn Model.
-
fit
(data, data_y=None)[source]¶ Fit and return self. Anything that evaluates properties related to the passed data should go here. For example, compute physical properties of a stucture and save them as class property, to be used in the transform method.
- Parameters
data (numpy array of shape [n_samples, n_features]) – Training set
data_y (numpy array of shape [n_samples]) – Target values
- Return type
- Returns
self object with fitted data
-
transform
(data)[source]¶ Get numerical features. Must be implemented by a child class.
- Parameters
data (numpy array of shape [n_samples, n_features]) – Training set
- Return type
numpy array of shape [n_samples, n_features_new]
- Returns
Transformed array
-
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.
X : {array-like, sparse matrix, dataframe} of shape (n_samples, n_features)
- yndarray of shape (n_samples,), default=None
Target values.
- **fit_paramsdict
Additional fit parameters.
- X_newndarray array of shape (n_samples, n_features_new)
Transformed array.
-
get_params
(deep=True)¶ Get parameters for this estimator.
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- paramsmapping of string to any
Parameter names mapped to their values.
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.- **paramsdict
Estimator parameters.
- selfobject
Estimator instance.
-