Ejemplo n.º 1
0
def opt_run():
    param_grid = [{'C': [1, 10, 100, 1000]}]
    clf = linear_model.LogisticRegression()
    grid_search = GridSearchCV(clf, cv=16, param_grid=param_grid)
    XX, Y = sensors_data.read_data(0)
    grid_search.fit(XX, Y)
    report(grid_search)
Ejemplo n.º 2
0
def run():
    if not os.path.isdir(config.model_logreg_folder):
        os.mkdir(config.model_logreg_folder)

    for i in range(120):
        XX, Y = sensors_data.read_data(i)
        clf = linear_model.LogisticRegression()
        scores = cross_validation.cross_val_score(clf, XX, Y, cv=16)

        save_model(clf, 'c1', i)

        print str(i) + '\t' + str(scores.mean()) + '\t' + str(scores.std())
        sys.stdout.flush()