matminer.featurizers.tests package¶
Submodules¶
matminer.featurizers.tests.test_bandstructure module¶
matminer.featurizers.tests.test_base module¶
-
class
matminer.featurizers.tests.test_base.FittableFeaturizer¶ Bases:
matminer.featurizers.base.BaseFeaturizerThis test featurizer tests fitting qualities of BaseFeaturizer, including refittability and different results based on different fits.
-
citations()¶ Citation(s) and reference(s) for this feature.
- Returns:
- (list) each element should be a string citation,
- ideally in BibTeX format.
-
feature_labels()¶ Generate attribute names.
- Returns:
- ([str]) attribute labels.
-
featurize(x)¶ Main featurizer function, which has to be implemented in any derived featurizer subclass.
- Args:
- x: input data to featurize (type depends on featurizer).
- Returns:
- (list) one or more features.
-
fit(X, y=None, **fit_kwargs)¶ Update the parameters of this featurizer based on available data
- Args:
- X - [list of tuples], training data
- Returns:
- self
-
implementors()¶ List of implementors of the feature.
- Returns:
- (list) each element should either be a string with author name (e.g.,
- “Anubhav Jain”) or a dictionary with required key “name” and other keys like “email” or “institution” (e.g., {“name”: “Anubhav Jain”, “email”: “ajain@lbl.gov”, “institution”: “LBNL”}).
-
-
class
matminer.featurizers.tests.test_base.MatrixFeaturizer¶ Bases:
matminer.featurizers.base.BaseFeaturizer-
citations()¶ Citation(s) and reference(s) for this feature.
- Returns:
- (list) each element should be a string citation,
- ideally in BibTeX format.
-
feature_labels()¶ Generate attribute names.
- Returns:
- ([str]) attribute labels.
-
featurize(*x)¶ Main featurizer function, which has to be implemented in any derived featurizer subclass.
- Args:
- x: input data to featurize (type depends on featurizer).
- Returns:
- (list) one or more features.
-
implementors()¶ List of implementors of the feature.
- Returns:
- (list) each element should either be a string with author name (e.g.,
- “Anubhav Jain”) or a dictionary with required key “name” and other keys like “email” or “institution” (e.g., {“name”: “Anubhav Jain”, “email”: “ajain@lbl.gov”, “institution”: “LBNL”}).
-
-
class
matminer.featurizers.tests.test_base.MultiArgs2¶ Bases:
matminer.featurizers.base.BaseFeaturizer-
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
-
feature_labels()¶ Generate attribute names.
- Returns:
- ([str]) attribute labels.
-
featurize(*x)¶ Main featurizer function, which has to be implemented in any derived featurizer subclass.
- Args:
- x: input data to featurize (type depends on featurizer).
- Returns:
- (list) one or more features.
-
-
class
matminer.featurizers.tests.test_base.MultiTypeFeaturizer¶ Bases:
matminer.featurizers.base.BaseFeaturizerA featurizer that returns multiple dtypes
-
feature_labels()¶ Generate attribute names.
- Returns:
- ([str]) attribute labels.
-
featurize(*x)¶ Main featurizer function, which has to be implemented in any derived featurizer subclass.
- Args:
- x: input data to featurize (type depends on featurizer).
- Returns:
- (list) one or more features.
-
-
class
matminer.featurizers.tests.test_base.MultipleFeatureFeaturizer¶ Bases:
matminer.featurizers.base.BaseFeaturizer-
citations()¶ Citation(s) and reference(s) for this feature.
- Returns:
- (list) each element should be a string citation,
- ideally in BibTeX format.
-
feature_labels()¶ Generate attribute names.
- Returns:
- ([str]) attribute labels.
-
featurize(x)¶ Main featurizer function, which has to be implemented in any derived featurizer subclass.
- Args:
- x: input data to featurize (type depends on featurizer).
- Returns:
- (list) one or more features.
-
implementors()¶ List of implementors of the feature.
- Returns:
- (list) each element should either be a string with author name (e.g.,
- “Anubhav Jain”) or a dictionary with required key “name” and other keys like “email” or “institution” (e.g., {“name”: “Anubhav Jain”, “email”: “ajain@lbl.gov”, “institution”: “LBNL”}).
-
-
class
matminer.featurizers.tests.test_base.SingleFeaturizer¶ Bases:
matminer.featurizers.base.BaseFeaturizer-
citations()¶ Citation(s) and reference(s) for this feature.
- Returns:
- (list) each element should be a string citation,
- ideally in BibTeX format.
-
feature_labels()¶ Generate attribute names.
- Returns:
- ([str]) attribute labels.
-
featurize(x)¶ Main featurizer function, which has to be implemented in any derived featurizer subclass.
- Args:
- x: input data to featurize (type depends on featurizer).
- Returns:
- (list) one or more features.
-
implementors()¶ List of implementors of the feature.
- Returns:
- (list) each element should either be a string with author name (e.g.,
- “Anubhav Jain”) or a dictionary with required key “name” and other keys like “email” or “institution” (e.g., {“name”: “Anubhav Jain”, “email”: “ajain@lbl.gov”, “institution”: “LBNL”}).
-
-
class
matminer.featurizers.tests.test_base.SingleFeaturizerMultiArgs¶ Bases:
matminer.featurizers.tests.test_base.SingleFeaturizer-
featurize(*x)¶ Main featurizer function, which has to be implemented in any derived featurizer subclass.
- Args:
- x: input data to featurize (type depends on featurizer).
- Returns:
- (list) one or more features.
-
-
class
matminer.featurizers.tests.test_base.SingleFeaturizerMultiArgsWithPrecheck¶ Bases:
matminer.featurizers.tests.test_base.SingleFeaturizerMultiArgs-
precheck(*x)¶ Precheck (provide an estimate of whether a featurizer will work or not) for a single entry (e.g., a single composition). If the entry fails the precheck, it will most likely fail featurization; if it passes, it is likely (but not guaranteed) to featurize correctly.
- Prechecks should be:
- accurate (but can be good estimates rather than ground truth)
- fast to evaluate
- unlikely to be obsolete via changes in the featurizer in the near
- future
This method should be overridden by any featurizer requiring its use, as by default all entries will pass prechecking. Also, precheck is a good opportunity to throw warnings about long runtimes (e.g., doing nearest neighbors computations on a structure with many thousand sites).
See the documentation for precheck_dataframe for more information.
- Args:
- *x (Composition, Structure, etc.): Input to-be-featurized. Can be
- a single input or multiple inputs.
- Returns:
- (bool): True, if passes the precheck. False, if fails.
-
-
class
matminer.featurizers.tests.test_base.SingleFeaturizerWithPrecheck¶ Bases:
matminer.featurizers.tests.test_base.SingleFeaturizer-
precheck(x)¶ Precheck (provide an estimate of whether a featurizer will work or not) for a single entry (e.g., a single composition). If the entry fails the precheck, it will most likely fail featurization; if it passes, it is likely (but not guaranteed) to featurize correctly.
- Prechecks should be:
- accurate (but can be good estimates rather than ground truth)
- fast to evaluate
- unlikely to be obsolete via changes in the featurizer in the near
- future
This method should be overridden by any featurizer requiring its use, as by default all entries will pass prechecking. Also, precheck is a good opportunity to throw warnings about long runtimes (e.g., doing nearest neighbors computations on a structure with many thousand sites).
See the documentation for precheck_dataframe for more information.
- Args:
- *x (Composition, Structure, etc.): Input to-be-featurized. Can be
- a single input or multiple inputs.
- Returns:
- (bool): True, if passes the precheck. False, if fails.
-
-
class
matminer.featurizers.tests.test_base.TestBaseClass(methodName='runTest')¶ Bases:
pymatgen.util.testing.PymatgenTest-
static
make_test_data()¶
-
setUp()¶ Hook method for setting up the test fixture before exercising it.
-
test_caching()¶ Test whether MultiFeaturizer properly caches
-
test_dataframe()¶
-
test_featurize_many()¶
-
test_fittable()¶
-
test_ignore_errors()¶
-
test_indices()¶
-
test_inplace()¶
-
test_matrix()¶ Test the ability to add features that are matrices to a dataframe
-
test_multifeature_no_zero_index()¶ Test whether multifeaturizer can handle series that lack a entry with index==0
-
test_multifeatures_multiargs()¶
-
test_multiindex_in_multifeaturizer()¶
-
test_multiindex_inplace()¶
-
test_multiindex_return()¶
-
test_multiple()¶
-
test_multiprocessing_df()¶
-
test_multitype_multifeat()¶ Test Multifeaturizer when a featurizer returns a non-numeric type
-
test_precheck()¶
-
test_stacked_featurizer()¶
-
static
matminer.featurizers.tests.test_composition module¶
-
class
matminer.featurizers.tests.test_composition.CompositionFeaturesTest(methodName='runTest')¶ Bases:
pymatgen.util.testing.PymatgenTest-
setUp()¶ Hook method for setting up the test fixture before exercising it.
-
test_ape()¶
-
test_atomic_orbitals()¶
-
test_band_center()¶
-
test_cation_properties()¶
-
test_cohesive_energy()¶
-
test_elec_affin()¶
-
test_elem()¶
-
test_elem_deml()¶
-
test_elem_matminer()¶
-
test_elem_matscholar_el()¶
-
test_elem_megnet_el()¶
-
test_en_diff()¶
-
test_fere_corr()¶
-
test_fraction()¶
-
test_ionic()¶
-
test_is_ionic()¶ Test checking whether a compound is ionic
-
test_miedema_all()¶
-
test_miedema_ss()¶
-
test_oxidation_states()¶
-
test_stoich()¶
-
test_tm_fraction()¶
-
test_valence()¶
-
test_yang()¶
-
matminer.featurizers.tests.test_conversions module¶
-
class
matminer.featurizers.tests.test_conversions.TestConversions(methodName='runTest')¶ Bases:
unittest.case.TestCase-
test_composition_to_oxidcomposition()¶
-
test_composition_to_structurefromMP()¶
-
test_conversion_multiindex()¶
-
test_conversion_multiindex_dynamic()¶
-
test_conversion_overwrite()¶
-
test_dict_to_object()¶
-
test_json_to_object()¶
-
test_str_to_composition()¶
-
test_structure_to_composition()¶
-
test_structure_to_oxidstructure()¶
-
test_to_istructure()¶
-
matminer.featurizers.tests.test_dos module¶
matminer.featurizers.tests.test_function module¶
matminer.featurizers.tests.test_site module¶
-
class
matminer.featurizers.tests.test_site.FingerprintTests(methodName='runTest')¶ Bases:
pymatgen.util.testing.PymatgenTest-
setUp()¶ Hook method for setting up the test fixture before exercising it.
-
tearDown()¶ Hook method for deconstructing the test fixture after testing it.
-
test_AverageBondAngle()¶
-
test_AverageBondLength()¶
-
test_afs()¶
-
test_bop()¶
-
test_chemenv_site_fingerprint()¶
-
test_chemicalSRO()¶
-
test_cns()¶
-
test_crystal_nn_fingerprint()¶
-
test_crystal_site_fingerprint()¶
-
test_dataframe()¶
-
test_ewald_site()¶
-
test_gaussiansymmfunc()¶
-
test_grdf()¶
-
test_local_prop_diff()¶
-
test_off_center_cscl()¶
-
test_op_site_fingerprint()¶
-
test_simple_cubic()¶ Test with an easy structure
-
test_site_elem_prop()¶
-
test_voronoifingerprint()¶
-
matminer.featurizers.tests.test_structure module¶
-
class
matminer.featurizers.tests.test_structure.StructureFeaturesTest(methodName='runTest')¶ Bases:
pymatgen.util.testing.PymatgenTest-
setUp()¶ Hook method for setting up the test fixture before exercising it.
-
test_GlobalInstabilityIndex()¶
-
test_SOAP()¶
-
test_bob()¶
-
test_bondfractions()¶
-
test_cgcnn_featurizer()¶
-
test_composition_features()¶
-
test_coulomb_matrix()¶
-
test_density_features()¶
-
test_dimensionality()¶
-
test_ewald()¶
-
test_global_symmetry()¶
-
test_jarvisCFID()¶
-
test_min_relative_distances()¶
-
test_orbital_field_matrix()¶
-
test_ordering_param()¶
-
test_packing_efficiency()¶
-
test_prdf()¶
-
test_rdf_and_peaks()¶
-
test_redf()¶
-
test_sine_coulomb_matrix()¶
-
test_sitestatsfingerprint()¶
-
test_ward_prb_2017_efftcn()¶ Test the effective coordination number attributes of Ward 2017
-
test_ward_prb_2017_lpd()¶ Test the local property difference attributes from Ward 2017
-
test_ward_prb_2017_strhet()¶
-
test_xrd_powderPattern()¶
-