Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Featurizer tuneup (WIP) #488

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
034c0fb
update rdf to have flat output
ardunn Jun 9, 2020
550b08a
Merge branch 'master' of https://github.com/hackingmaterials/matminer…
ardunn Jul 8, 2020
8b1a87b
fix prdf docs
ardunn Jul 8, 2020
bc4b22e
move has_oxidation_states to a separate utils file, add prechecking t…
ardunn Jul 9, 2020
57e9b1c
flatten erdf draft 1 (remove auto-diagonal as the default cutoff)
ardunn Jul 9, 2020
e4b1790
working flat erdf
ardunn Jul 9, 2020
b0376f5
separate bin labels into a separate function which both RDF and ReDF …
ardunn Jul 9, 2020
a16c332
working on ReDF tests
ardunn Jul 9, 2020
b635de9
redf passing more tests
ardunn Jul 9, 2020
8d3a35f
add test for common labelling function for *RDF classes
ardunn Jul 9, 2020
00c368a
shorten precheck for ReDF
ardunn Jul 9, 2020
114b58b
draft of new minimumrelativedistances
ardunn Jul 10, 2020
21b9599
semi working structure MRD w/o tests
ardunn Jul 10, 2020
d9d08ea
update minimum relative distances docstrings
ardunn Jul 10, 2020
1fe7d8f
wip mrd test update
ardunn Jul 10, 2020
8fe2044
working and final minimumrelativedistances
ardunn Jul 10, 2020
e8b523d
add feature labels check to rdf
ardunn Jul 18, 2020
4923243
fix #253, somewhat
ardunn Jul 18, 2020
9fd81db
update dscribe requirement
ardunn Jul 23, 2020
b44f0bb
add soap preset, closes #420
ardunn Jul 24, 2020
a26efd8
Merge branch 'master' of https://github.com/hackingmaterials/matminer…
ardunn Jul 24, 2020
68c90a6
add automatminer citation in bibtext_refs in dataset metadata
ardunn Sep 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions matminer/datasets/dataset_metadata.json

Large diffs are not rendered by default.

20 changes: 2 additions & 18 deletions matminer/featurizers/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from matminer.featurizers.base import BaseFeaturizer
from matminer.featurizers.utils.stats import PropertyStats
from matminer.featurizers.utils.oxidation import has_oxidation_states
from matminer.utils.data import DemlData, MagpieData, PymatgenData, \
CohesiveEnergyData, MixingEnthalpy, MatscholarElementData, MEGNetElementData

Expand All @@ -25,24 +26,6 @@
module_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(module_dir, "..", "utils", "data_files")


# Utility operations
def has_oxidation_states(comp):
"""Check if a composition object has oxidation states for each element

TODO: Does this make sense to add to pymatgen? -wardlt

Args:
comp (Composition): Composition to check
Returns:
(boolean) Whether this composition object contains oxidation states
"""
for el in comp.elements:
if not hasattr(el, "oxi_state") or el.oxi_state is None:
return False
return True


def is_ionic(comp):
"""Determines whether a compound is an ionic compound.

Expand Down Expand Up @@ -1186,6 +1169,7 @@ def citations(self):
"url = {http://linkinghub.elsevier.com/retrieve/pii/S0927025614007113}, "
"volume = {97}, year = {2015} } "]


class Miedema(BaseFeaturizer):
"""
Formation enthalpies of intermetallic compounds, from Miedema et al.
Expand Down
21 changes: 21 additions & 0 deletions matminer/featurizers/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -2488,6 +2488,27 @@ def __init__(
self.soap = None
self.n_elements = None


@classmethod
def from_preset(cls, preset):
"""
Create a SOAP featurizer object from sensible or published presets.

Args:
preset (str): Choose from:
"formation energy": Preset used for formation energy prediction
in the original Dscribe paper.

Returns:

"""
valid_presets = ["formation_energy"]
if preset == "formation_energy":
return cls(6, 8, 8, 0.4, True, "gto", True)
else:
raise ValueError(f"'{preset}' is not a valid preset. Choose from {valid_presets}")


def _check_fitted(self):
if not self.soap:
raise NotFittedError("Please fit SOAP before featurizing.")
Expand Down
Loading