Пример #1
0
    'Ti', 'Ta', 'Hf', 'Re', 'V', 'B', 'N', 'O', 'S', 'Zr'
]
df[ele] = df[ele].fillna(0)
df = df.dropna(subset=[
    'CT_RT', 'CT_CS', 'CT_EL', 'CT_RA', 'CT_Temp', 'Normal', 'Temper1',
    'AGS No.', 'CT_MCR'
])
df['log_CT_CS'] = np.log(df['CT_CS'])
df['log_CT_MCR'] = np.log(df['CT_MCR'])

features = [
    i for i in df.columns if i not in ['CT_RT', 'CT_CS', 'CT_MCR', 'ID']
]
X = df[features].to_numpy(np.float32)
y = df['CT_RT'].to_numpy(np.float32)

pdata = ProcessData(X=X, y=y, features=features)
#pdata.clean_data(scale_strategy={'strategy': 'power_transform',
#    'method': 'yeo-johnson'})
pdata.clean_data(scale_strategy={'strategy': 'RobustScaler'})
data = pdata.get_data()
scale = pdata.scale
del pdata

X = data['X'][data['y'] < 200000]
y = data['y'][data['y'] < 200000]

skreg = SKREG(X=X, y=y, estimator='LR', validation='5-Fold')
skreg.run_reg()
print(skreg.__dict__)
Пример #2
0
features = [i for i in df.columns if i not in ['CT_RT', 'CT_Temp', 
    'ID', 'CT_CS', 'LMP_Model', 'CT_MCR']]
df = df[df['CT_RT'] < 200000]
X = df[features].to_numpy(np.float32)
y = df['LMP_Model'].to_numpy(np.float32)
y2 = df[['ID', 'CT_RT', 'CT_Temp', 'CT_CS']].values.tolist()

pdata = ProcessData(X=X, y=y, y2=y2, features=features)
pdata.clean_data()
data = pdata.get_data()
scale = pdata.scale
del pdata

CT_RT = np.array([i[1] for i in data['y2']])
CT_Temp = np.array([i[2] for i in data['y2']])
CT_CS = np.array([i[3] for i in data['y2']])
ID = [i[0] for i in data['y2']]
C = np.array([25 for i in ID])

skreg = SKREG(X=data['X'],
              y=data['y'],
              estimator="LR",
              validation="3-Fold",
              CT_Temp=CT_Temp,
              CT_RT=CT_RT,
              C=C)

skreg.run_reg()
print(skreg.__dict__)

Пример #3
0
    'activation': ['relu'],
    'solver': ['lbfgs'],
    'alpha': [
        0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.01, 0.02, 0.03, 0.04, 0.05,
        0.06
    ],
    'learning_rate': ['constant']
}

mlpgrid = SKGridReg(X=X,
                    y=y,
                    estimator='MLP',
                    estimator_param_space=param_space,
                    cv=10)
mlpgrid.run_grid_search()
print(mlpgrid.__dict__)
np.save('grid_results_without_weighted.npy', mlpgrid.__dict__)

skmlp = SKREG(X=X,
              y=y,
              estimator='MLP',
              estimator_param=mlpgrid.best_params,
              validation='5-Fold')
skmlp.run_reg()
skmlp.__dict__['features'] = metadata
print(skmlp.__dict__)

np.save('mlp_run.npy', skmlp.__dict__)
skmlp.plot_parity(data='train').savefig('train_parity_plot.png')
skmlp.plot_parity(data='test').savefig('test_parity_plot.png')