How to use the matminer.featurizers.structure.BondFractions function in matminer

To help you get started, we’ve selected a few matminer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hackingmaterials / automatminer / automatminer / featurization / sets.py View on Github external
def need_fit(self):
        fs = [
            sf.PartialRadialDistributionFunction(),
            sf.BondFractions(),
            sf.BagofBonds(coulomb_matrix=sf.CoulombMatrix()),
            sf.BagofBonds(coulomb_matrix=sf.SineCoulombMatrix()),
        ]
        return self._get_featurizers(fs)
github hackingmaterials / automatminer / matbench / pipeline.py View on Github external
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

# Try predict ehull from initial structure
n = 500
print("Reading csv for {} compounds...".format(n))
df = load_mp('mp_all.csv').sample(n=n)
print("Constructing {} structures from dictionaries...".format(n))
df['structure'] = [Structure.from_dict(s) for s in df['structure']]
df['initial structure'] = [Structure.from_dict(s) for s in df['initial structure']]
df['composition'] = [f.composition for f in df['structure']]

# Pick featurizers
ep = ElementProperty.from_preset("matminer")
bb = BagofBonds()
bf = BondFractions(approx_bonds=True)
sh = StructuralHeterogeneity()
co = ChemicalOrdering()
de = DensityFeatures()
composition_featurizers = [ep]
structure_featurizers = [bf, sh, co, de]


# Featurizing
fls = []
for cf in composition_featurizers:
    print("Featurizing {}...".format(cf.__class__.__name__))
    cf.fit_featurize_dataframe(df, 'composition', ignore_errors=True)
    fls += cf.feature_labels()

for sf in structure_featurizers:
    print("Featurizing {}...".format(sf.__class__.__name__))
github hackingmaterials / automatminer / automatminer / featurization / sets.py View on Github external
def all(self):
        fs = [
            # Vector
            self.ssf.from_preset("CrystalNNFingerprint_ops"),
            self.ssf.from_preset("BondLength-dejong2016"),
            self.ssf.from_preset("BondAngle-dejong2016"),
            self.ssf.from_preset("Composition-dejong2016_SD"),
            self.ssf.from_preset("Composition-dejong2016_AD"),
            self.ssf.from_preset("CoordinationNumber_ward-prb-2017"),
            self.ssf.from_preset("LocalPropertyDifference_ward-prb-2017"),
            sf.BondFractions(approx_bonds=False),
            sf.BagofBonds(coulomb_matrix=sf.CoulombMatrix()),
            sf.BagofBonds(coulomb_matrix=sf.SineCoulombMatrix()),
            sf.CoulombMatrix(flatten=True),
            sf.BondFractions(),
            # Non vector
            sf.CoulombMatrix(flatten=False),  # returns matrix
            sf.SineCoulombMatrix(flatten=False),  # returns matrix
            sf.RadialDistributionFunction(),  # returns dict
            sf.MinimumRelativeDistances(),  # returns a list
            sf.ElectronicRadialDistributionFunction(),  # returns ??
            sf.PartialRadialDistributionFunction(),  # returns ??
        ]
        fs += self.heavy
        return self._get_featurizers(fs)
github hackingmaterials / automatminer / automatminer / featurization / sets.py View on Github external
def all(self):
        fs = [
            # Vector
            self.ssf.from_preset("CrystalNNFingerprint_ops"),
            self.ssf.from_preset("BondLength-dejong2016"),
            self.ssf.from_preset("BondAngle-dejong2016"),
            self.ssf.from_preset("Composition-dejong2016_SD"),
            self.ssf.from_preset("Composition-dejong2016_AD"),
            self.ssf.from_preset("CoordinationNumber_ward-prb-2017"),
            self.ssf.from_preset("LocalPropertyDifference_ward-prb-2017"),
            sf.BondFractions(approx_bonds=False),
            sf.BagofBonds(coulomb_matrix=sf.CoulombMatrix()),
            sf.BagofBonds(coulomb_matrix=sf.SineCoulombMatrix()),
            sf.CoulombMatrix(flatten=True),
            sf.BondFractions(),
            # Non vector
            sf.CoulombMatrix(flatten=False),  # returns matrix
            sf.SineCoulombMatrix(flatten=False),  # returns matrix
            sf.RadialDistributionFunction(),  # returns dict
            sf.MinimumRelativeDistances(),  # returns a list
            sf.ElectronicRadialDistributionFunction(),  # returns ??
            sf.PartialRadialDistributionFunction(),  # returns ??
        ]
        fs += self.heavy
        return self._get_featurizers(fs)