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: 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
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.matsci.mlearn.base', '__doc__': '\n Class that MUST be inherited to create sklearn Model.\n ', 'fit': <function BaseFeaturizer.fit>, 'transform': <function BaseFeaturizer.transform>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__getstate__
()¶
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.application.matsci.mlearn.base'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
()¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__setstate__
(state)¶
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
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
-