コード例 #1
0
        y_pred = self.predict(X) / sizes
        y_true = y / sizes
        return sklearn.metrics.r2_score(y_true, y_pred)

    def length(self, vec):
        return vec[vec != 0].shape[0]

# SCM evaluation
DIAG = True
print ("DIAG ELEMS", DIAG)

# Featurize dataframe with sine coulomb matrix and time it
start = time.monotonic()
scm = SineCoulombMatrix(DIAG)
# Set the number of jobs for parallelization
scm.set_n_jobs(NJOBS)
df = scm.featurize_dataframe(df, 'structure')
# Take the eigenvalues of the SCMs to form vector descriptors
df['sine coulomb matrix'] = pd.Series([np.sort(np.linalg.eigvals(s))[::-1] \
    for s in df['sine coulomb matrix']], df.index)
finish = time.monotonic()
print ("TIME TO FEATURIZE SCM %f SECONDS" % (finish-start))
print()

# Set up KRR model
krr = KrrScm()
print(krr.get_params().keys())

# Initialize hyperparameter grid search
hpsel = GridSearchCV(krr, params['sine coulomb matrix'], cv=inner_cv, refit=True)
X = df['sine coulomb matrix'].as_matrix()
コード例 #2
0
        y_true = y / sizes
        return sklearn.metrics.r2_score(y_true, y_pred)

    def length(self, vec):
        return vec[vec != 0].shape[0]


# SCM evaluation
DIAG = True
print("DIAG ELEMS", DIAG)

# Featurize dataframe with sine coulomb matrix and time it
start = time.monotonic()
scm = SineCoulombMatrix(DIAG)
# Set the number of jobs for parallelization
scm.set_n_jobs(NJOBS)
df = scm.featurize_dataframe(df, 'structure')
# Take the eigenvalues of the SCMs to form vector descriptors
df['sine coulomb matrix'] = pd.Series(
    [np.sort(np.linalg.eigvals(s))[::-1] for s in df['sine coulomb matrix']],
    df.index)
finish = time.monotonic()
print("TIME TO FEATURIZE SCM %f SECONDS" % (finish - start))
print()

# Set up KRR model
krr = KrrScm()
print(krr.get_params().keys())

# Initialize hyperparameter grid search
hpsel = GridSearchCV(krr,
コード例 #3
0
centro_dielectric_tensor=np.load('/Users/dennistrujillo/Dropbox/mp_share_dt_ag/dielectric_total/centro_diel.npy',allow_pickle=True)

data = {'structures': centrosymmetric_structures, 'ids' : task_ids}
df = pd.DataFrame(data)


#soap representation
#from matminer.featurizers.structure import SOAP 
#soap = SOAP(periodic=True)
#soap=soap.fit(data['structures'])
#labels=soap.feature_labels()
#df = soap.featurize_dataframe(df,'structures')

from matminer.featurizers.structure import SineCoulombMatrix
sine_coulomb = SineCoulombMatrix()
sine_coulomb.set_n_jobs(28)
sine_coulomb.fit(centrosymmetric_structures)#data['structures'])
labels=sine_coulomb.feature_labels()
df  = sine_coulomb.featurize_dataframe(df, 'structures')#,ignore_errors=True)

#agni
#from matminer.featurizers.site import AGNIFingerprints 
#agni=AGNIFingerprints(directions=['x','y','z']) 
#agni.set_n_jobs(28)
#labels=agni.feature_labels()
#df = agni.featurize(df['structures'],0)
#df  = agni.featurize_dataframe(df, ['structures', 'site'])#,ignore_errors=True)

#get s_vs_ep
ec_list=[]
for item in centro_elastic_compliance: