schrodinger.application.matsci.mlearn.features module¶
Classes and functions to deal with ML features.
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.application.matsci.mlearn.features.
avg_atomic_vol
(struct)¶ Get average atomic volume.
Parameters: struct ( schrodinger.structure.Structure
) – Structure to be used for feature calculationReturn type: float Returns: Average atomic volume (A^3)
-
schrodinger.application.matsci.mlearn.features.
get_distance_cell
(struct, cutoff, cell, pbc)¶ Create an infrastructure Distance Cell. Struct MUST have the Chorus box properties.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: schrodinger.structure.Structure
, ,schrodinger.infra.structure.DistanceCell
,schrodinger.infra.structure.PBC
Returns: Supercell, an infrastructure Distance Cell that accounts for the PBC, and the pbc used to create it.
Raise: ValueError if struct is missing PBCs
- struct (
-
schrodinger.application.matsci.mlearn.features.
elemental_generator
(struct, element, is_equal=True)¶
-
schrodinger.application.matsci.mlearn.features.
avg_neighbor_count
(struct, element, cutoff, cell=None, pbc=None)¶ Get average neighbor count.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the count
- cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Average neighbor count
- struct (
-
schrodinger.application.matsci.mlearn.features.
std_neighbor_count
(struct, element, cutoff, cell=None, pbc=None)¶ Get standard deviation of neighbor count.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the count
- cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Average neighbor count
- struct (
-
schrodinger.application.matsci.mlearn.features.
avg_element_neighbor_count
(struct, cutoff, element, cell=None, pbc=None)¶ Get average element neighbor count.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - cutoff (float) – The cutoff for finding nearest neighbor atoms
- element (str) – Element for which to compute the average
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Average number of bonds per element
- struct (
-
schrodinger.application.matsci.mlearn.features.
avg_sublattice_neighbor_count
(struct, element, cutoff, cell=None, pbc=None)¶ Get average sublattice neighbor count.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the average
- cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Average sublattice neighbor count
- struct (
-
schrodinger.application.matsci.mlearn.features.
avg_neighbor_ion
(struct, element, cutoff, cell=None, pbc=None)¶ Get average neighbor ionicity.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the average
- cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Average neighbor ionicity
- struct (
-
schrodinger.application.matsci.mlearn.features.
std_neighbor_ion
(struct, element, cutoff, cell=None, pbc=None)¶ Get standard deviation of neighbor ionicity.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the average
- cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Average neighbor ionicity
- struct (
-
schrodinger.application.matsci.mlearn.features.
avg_sublattice_neighbor_ion
(struct, element, cutoff, cell=None, pbc=None)¶ Get average sublattice neighbor ionicity.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the average
- cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Average sublattice neighbor count
- struct (
-
schrodinger.application.matsci.mlearn.features.
get_anion
(struct)¶ Get the most electronegative element in the structure (anion).
Parameters: struct ( schrodinger.structure.Structure
) – Input structureReturn type: str, float, int Returns: Element, it’s electronegativity, number of anions in the cell
-
schrodinger.application.matsci.mlearn.features.
vol_per_anion
(struct)¶ Get volume per anion.
Parameters: struct ( schrodinger.structure.Structure
) – Input structureReturn type: float Returns: Volume per anion
-
schrodinger.application.matsci.mlearn.features.
avg_anion_anion_short_distance
(struct, supercell)¶ Get average anion anion shortest distance.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - struct – Supercell input structure
Return type: float
Returns: Average anion anion shortest distance
- struct (
-
schrodinger.application.matsci.mlearn.features.
avg_element_anion_short_distance
(struct, element, supercell)¶ Get average element anion shortest distance.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the average
- struct – Supercell input structure
Return type: float
Returns: Average element anion shortest distance
- struct (
-
schrodinger.application.matsci.mlearn.features.
avg_element_element_short_distance
(struct, element, supercell)¶ Get average element element shortest distance.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - element (str) – Element for which to compute the average
- struct – Supercell input structure
Return type: float
Returns: Average element element shortest distance
- struct (
-
schrodinger.application.matsci.mlearn.features.
anion_frame_coordination
(struct, supercell)¶ Get anion framework coordination.
Parameters: - struct (
schrodinger.structure.Structure
) – Input structure - struct – Supercell input structure
Return type: float
Returns: Anion framework coordination
- struct (
-
schrodinger.application.matsci.mlearn.features.
avg_sublattice_eneg
(struct, element)¶ Get average sublattice electronegativity.
Parameters: - struct (schrodinger.structure.Structure) – Input structure
- element (str) – Element which to exclude from lattice
Return type: float
Returns: Average sublattice electronegativity
-
schrodinger.application.matsci.mlearn.features.
packing_fraction
(struct, cutoff, cell=None, pbc=None)¶ Get packing fraction of the crystal.
Parameters: - struct (schrodinger.structure.Structure) – Input structure
- cutoff (float) – The cutoff for finding nearest neighbor atoms
- cell (
schrodinger.infra.structure.DistanceCell
) – Distance cell object for the struct - pbc (
schrodinger.infra.structure.PBC
) – PBC object for the struct
Return type: float
Returns: Packing fraction
-
class
schrodinger.application.matsci.mlearn.features.
LatticeFeatures
(element='Li', cutoff=4.0)¶ Bases:
schrodinger.application.matsci.mlearn.base.BaseFeaturizer
Class to generate lattice-based features.
-
__init__
(element='Li', cutoff=4.0)¶ Initialize the object.
-
transform
(structs)¶ Get numerical features from structures. Also sets features names in self.labels. See parent class for more documentation.
Parameters: structs (list( schrodinger.structure.Structure
)) – List of structures to be featurizedReturn type: numpy array of shape [n_samples, n_features] Returns: Transformed array
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.matsci.mlearn.features', '__doc__': '\n Class to generate lattice-based features.\n ', '__init__': <function LatticeFeatures.__init__>, 'transform': <function LatticeFeatures.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_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.features'¶
-
__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
(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
-
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
-