示例#1
0
forest 4-->tr: 0.866979504134,val: 0.572140934661,cost 108
forest 5-->tr: 0.865444728731,val: 0.565962549302,cost 105
forest 6-->tr: 0.847071811478,val: 0.550088494652,cost 105
forest 7-->tr: 0.867795690777,val: 0.55928161695,cost 110
forest 8-->tr: 0.849556952293,val: 0.54308323331,cost 111
forest 9-->tr: 0.852024718779,val: 0.558287108709,cost 105
'''
#%%
'''
validating on training dataset
'''

forest_2nd = []
for forest_idx in range(0, 10, 1):
    model = read_variable('final/2nd_level_models/' + str(forest_idx))
    forest_2nd.append(model)

val_Y_sum = np.zeros(val_Y.shape[0])
for model in forest_2nd:
    val_Y_pred = model.predict(val_votes)
    print('mcc:', matthews_corrcoef(val_Y, val_Y_pred))
    val_Y_sum += val_Y_pred

#%%
'''
mcc: 0.572089121234
mcc: 0.584374265357
mcc: 0.574731321479
mcc: 0.561043527534
mcc: 0.56279640286
mcc: 0.568082925197
示例#2
0
文件: vmspms.py 项目: GANES1998/drhmm
from sklearn.cross_validation import train_test_split

i = 0

from imblearn.over_sampling.smote import SMOTE

sm = SMOTE()

pd_tf_np = ss.fit_transform(pd_tf_np)

out = np.ones(shape=(250, 9))

rfc = []
for i in range(9):
    rfc.append(RandomForestClassifier(n_estimators=400))

res = []

for i in range(9):

    #x_train,x_test,y_train,y_test = train_test_split(pd_tf_np,y_vals.iloc[:,i].values)

    x_train, x_test = pd_tf_np[250:, :], pd_tf_np[:250, :]

    y_train, y_test = y_vals.iloc[:,
                                  i].values[250:], y_vals.iloc[:,
                                                               i].values[:250]

    #ss = StandardScaler()