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

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Class that MUST be inherited to create sklearn Model.

fit(data, data_y=None)

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:

BaseFeaturizer

Returns:

self object with fitted data

transform(data)

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
__init__

Initialize self. See help(type(self)) for accurate signature.

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 : numpy array of shape [n_samples, n_features]
Training set.
y : numpy array of shape [n_samples]
Target values.
X_new : numpy array of shape [n_samples, n_features_new]
Transformed array.
get_params(deep=True)

Get parameters for this estimator.

deep : boolean, optional
If True, will return the parameters for this estimator and contained subobjects that are estimators.
params : mapping 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.

self