Exemple #1
0
 def f(mi, s, md, r, c):
     clf = BoostedTreesClassifier(max_iterations = mi,
             step_size = s,
             max_depth = md,
             row_subsample = r,
             column_subsample = c,
             verbose = 0)
     clf.fit(X[valid_idx], y[valid_idx])
     #yhat = clf.predict_proba(X[train_idx])
     #return -log_loss(y[train_idx], yhat)
     return clf.score(X[train_idx], y[train_idx])
Exemple #2
0
 def f(params):
     mi = params['mi']
     md = params['md']
     s = params['s']
     r = params['r']
     c = params['c']
     mi = int(mi)
     md = int(md)
     clf = BoostedTreesClassifier(max_iterations = mi,
             step_size = s,
             max_depth = md,
             row_subsample = r,
             column_subsample = c,
             verbose = 0)
     clf.fit(X[valid_idx], y[valid_idx])
     yhat = clf.predict_proba(X[train_idx])
     return log_loss(y[train_idx], yhat)
Exemple #3
0
import numpy as np
import itertools
from scipy.stats import uniform
from scipy.stats import randint
import logging 

from ml import *


X, _ = GetDataset('original')
_, y, _ = LoadData()

from gl import BoostedTreesClassifier
clf = BoostedTreesClassifier(verbose = 0)
clf.fit(X[:10], y[:10])
np.random.seed(1)
if False:
    Cs = [.001, .01, .1, 1., 10.]
    gammas = [.001, .01, .1, 1., 10.]
    res = []; i = 0
    for (C, gamma) in itertools.product(Cs, gammas):
        print i, C, gamma; i += 1
        clf = SVC(C = C, gamma = gamma)
        clf.fit(X[train], y[train])
        res.append(clf.score(X[valid], y[valid]))

    res2 = []
    for i in xrange(len(res)*100):
        C     = 10**uniform(-3.5,5).rvs()
        gamma = 10**uniform(-3.5,5).rvs()
        print i, C, gamma