Exemple #1
0
    cov = cov.set_axis(X_frame_abbr, axis='index', inplace=False)
    cov = cov.set_axis(X_frame_abbr, axis='columns', inplace=False)

    fig = plt.figure()
    fig.add_subplot(111)
    sns.heatmap(cov, vmin=-1, vmax=1, cmap="bwr", linewidths=0.3, xticklabels=True, yticklabels=True, square=True,
                annot=True, annot_kws={'size': 3})
    plt.show()
    corr_plot(corr.cov_shrink, X_frame_abbr, left_down="fill", right_top="pie", threshold_right=0, front_raito=0.5)

    list_name, list_abbr = name_to_name(X_frame_name, X_frame_abbr, search=corr.list_count, search_which=0,
                                        return_which=(1, 2),
                                        two_layer=True)

    store.to_csv(cov, "cov")
    store.to_txt(list_name, "list_name")
    store.to_txt(list_abbr, "list_abbr")

    # 2
    select = ['volume', 'destiny', 'lattice constants a', 'lattice constants c', 'radii covalent',
              'radii ionic(shannon)',
              'distance core electron(schubert)', 'latent heat of fusion', 'energy cohesive brewer', 'total energy',
              'charge nuclear effective(slater)', 'valence electron number', 'electronegativity(martynov&batsanov)',
              'volume atomic(villars,daams)']  # human select

    select_index, select_abbr = name_to_name(X_frame_name, X_frame_abbr, search=select, search_which=1,
                                             return_which=(0, 2),
                                             two_layer=False)

    cov_select = corr.cov_shrink[select_index, :][:, select_index]
Exemple #2
0
param_grid3 = [{'n_estimators': [100, 200], 'learning_rate': [0.1, 0.05]}]

# 2 model
ref = RFECV(me2, cv=3)
x_ = ref.fit_transform(x, y)
gd = GridSearchCV(me2, cv=3, param_grid=param_grid2, scoring="r2", n_jobs=1)
gd.fit(x_, y)
score = gd.best_score_

# 1,3 model
# gd = GridSearchCV(me1, cv=3, param_grid=param_grid1, scoring="r2", n_jobs=1)
# gd.fit(x,y)
# es = gd.best_estimator_
# sf = SelectFromModel(es, threshold=None, prefit=False,
#                  norm_order=1, max_features=None)
# sf.fit(x,y)
# feature = sf.get_support()
#
# gd.fit(x[:,feature],y)
# score = gd.best_score_

# 其他模型
# 穷举等...

# 导出
# pd.to_pickle(gd,r'C:\Users\Administrator\Desktop\skk\gd_model')
# pd.read_pickle(r'C:\Users\Administrator\Desktop\skk\gd_model')
store.to_pkl_sk(gd)
store.to_csv(x)
store.to_txt(score)