Beispiel #1
0
    stats2 = Statistics(lambda ind: 0 if ind else 0)
    stats2.register("countable_number", np.sum)
    stats = MultiStatistics(score1=stats1, score2=stats2)

    population, logbook = eaSimple(pop, toolbox, cxpb=cxpb, mutpb=mutpb, ngen=ngen, stats=stats,
                                   halloffame=hof, pset=pset, store=store)

    return hof


if __name__ == '__main__':
    # 输入
    store = Store(r'D:\sy')
    data = Call(r'D:\sy')

    data_import = data.xlsx().featuredata
    name_abbr = data_import.columns.values
    x_name = name_abbr[:-1]
    # data_import = data_import.iloc[np.where(data_import['f1'] <= 1)[0]]

    X_frame = data_import[x_name]
    y_frame = data_import['y']

    X = X_frame.values
    y = y_frame.values

    # 处理
    # scal = preprocessing.MinMaxScaler()
    # X = scal.fit_transform(X)

    X, y = shuffle(X, y, random_state=0)
Beispiel #2
0
import pandas as pd
import sklearn
from sklearn import svm
from sklearn.model_selection import GridSearchCV, LeaveOneOut
from sklearn.preprocessing import MinMaxScaler

from featurebox.selection.backforward import BackForward
from featurebox.tools.exports import Store
from featurebox.tools.imports import Call

warnings.filterwarnings("ignore")

# 数据导入
store = Store(r'/data/home/wangchangxin/data/zlj/')
data = Call(r'/data/home/wangchangxin/data/zlj/', index_col=None)
all_import = data.xlsx().data

x_name = all_import.index.values
y = all_import["y"].values
x_frame = all_import.drop("y", axis=1)
x = x_frame.values
# # 预处理
# minmax = MinMaxScaler()
# x = minmax.fit_transform(x)
# 数据划分
xtrain, xtest = x[3:], x[:3]
ytrain, ytest = y[3:], y[:3]

xtrain, ytrain = sklearn.utils.shuffle(xtrain, ytrain, random_state=3)

# x = minmax.inverse_transform(x_new)
Beispiel #3
0
    # x3 = x[:, 3]
    #
    # t = expr01
    # func0 = sympy.utilities.lambdify(terminals, t)
    # re = func0(*x.T)
    # p = BasePlot(font=None)
    # p.scatter(y, re, strx='Experimental $E_{gap}$', stry='Calculated $E_{gap}$')
    # import matplotlib.pyplot as plt
    #
    # plt.show()


if __name__ == '__main__':
    store = Store(r'C:\Users\Administrator\Desktop\band_gap_exp\4.symbol')
    data = Call(r'C:\Users\Administrator\Desktop\c', index_col=None)
    data_import = data.xlsx().sr

    X = data_import["delt_x"].values
    input_x = data_import[["delt_x", "G"]].values

    Pexp = data_import["Pexp"].values
    Pmix = data_import["Pmix"].values

    G = data_import["G"].values
    y = data_import["PG_y"].values
    y = y * G
    testfunc = input_x[:, 0] * input_x[:, 1]
    t = np.corrcoef(y, input_x[:, 0] * input_x[:, 1])

    dim1 = Dim([0, 0, 0, 0, 0, 0, 0])
    target_dim = [Dim([0, 0, 0, 0, 0, 0, 0])]