コード例 #1
0
ファイル: multimodel_class.py プロジェクト: flaviovdf/pyksc
def run_classifier(out_folder, trend_probs, referrers, y, train, test):

    F = referrers #static features
    etree = create_grid_search('lr', n_jobs = 1)
    
    y_pred = trend_probs[test].argmax(axis=1)
    save_results(out_folder, 'tl-base-lr', y_pred, y[test])

    aux = clone(etree)
    aux.fit(F[train], y[train])
    y_pred = aux.predict(F[test])
    save_results(out_folder, 'tree-feats', y_pred, y[test])
    
    aux = clone(etree)
    aux.fit(trend_probs[train], y[train])
    y_pred = aux.predict(trend_probs[test])
    save_results(out_folder, 'tree-probs', y_pred, y[test])
    
    C = np.hstack((F, trend_probs))
    aux = clone(etree)
    aux.fit(C[train], y[train])
    y_pred = aux.predict(C[test])
    save_results(out_folder, 'meta-combine', y_pred, y[test])

    #stack_clf = stacking.Stacking(3, [etree], 'tree')
    #stack_clf.fit(F[train], y[train], trend_probs[train])
    #y_pred = stack_clf.predict(F[test], trend_probs[test])
    #save_results(out_folder, 'meta-stack-tree', y_pred)
    
    stack_clf = stacking.Stacking(3, [etree], 'linear')
    stack_clf.fit(F[train], y[train], trend_probs[train])
    y_pred = stack_clf.predict(F[test], trend_probs[test])
    save_results(out_folder, 'meta-stack-linear', y_pred, y[test])
コード例 #2
0
ファイル: multimodel_class.py プロジェクト: FlorentF9/pyksc
def run_classifier(out_folder, trend_probs, referrers, y, train, test):

    F = referrers #static features
    etree = create_grid_search('lr', n_jobs = 1)
    
    y_pred = trend_probs[test].argmax(axis=1)
    save_results(out_folder, 'tl-base-lr', y_pred, y[test])

    aux = clone(etree)
    aux.fit(F[train], y[train])
    y_pred = aux.predict(F[test])
    save_results(out_folder, 'tree-feats', y_pred, y[test])
    
    aux = clone(etree)
    aux.fit(trend_probs[train], y[train])
    y_pred = aux.predict(trend_probs[test])
    save_results(out_folder, 'tree-probs', y_pred, y[test])
    
    C = np.hstack((F, trend_probs))
    aux = clone(etree)
    aux.fit(C[train], y[train])
    y_pred = aux.predict(C[test])
    save_results(out_folder, 'meta-combine', y_pred, y[test])

    #stack_clf = stacking.Stacking(3, [etree], 'tree')
    #stack_clf.fit(F[train], y[train], trend_probs[train])
    #y_pred = stack_clf.predict(F[test], trend_probs[test])
    #save_results(out_folder, 'meta-stack-tree', y_pred)
    
    stack_clf = stacking.Stacking(3, [etree], 'linear')
    stack_clf.fit(F[train], y[train], trend_probs[train])
    y_pred = stack_clf.predict(F[test], trend_probs[test])
    save_results(out_folder, 'meta-stack-linear', y_pred, y[test])
コード例 #3
0
ファイル: stacking.py プロジェクト: antoine-tran/pyksc
 def __init__(self):
     self.model = etree = create_grid_search('extra_trees', n_jobs = 1)
コード例 #4
0
ファイル: stacking.py プロジェクト: regstrtn/pyksc
 def __init__(self):
     self.model = etree = create_grid_search('extra_trees', n_jobs = 1)