<commit_before>import numpy as np
import pandas as pd
from my_settings import *

from sklearn.ensemble import AdaBoostClassifier, GradientBoostingClassifier
from sklearn.cross_validation import StratifiedShuffleSplit, cross_val_score
from sklearn.grid_search import GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline

data = pd.read_csv(data_path +
                   "alpha_mean_pow_data_extracted_phase_target.csv")
data = data.drop("mean", 1)
data["corr"], corr_lbl = pd.factorize(data.correct)

data_dv = pd.get_dummies(data[["ROI", "condition_side",
                               "condition_type", "phase"]])
data_dv["pow"] = data.power

data_itc = pd.read_csv(data_path +
                       "alpha_mean_itc_data_extracted_phase_target.csv")
data_itc = data_itc.drop("mean", 1)

data_dv["itc"] = data_itc["itc"]

y = data["corr"].get_values()
X = data_dv.get_values()


cv = StratifiedShuffleSplit(y, n_iter=10)
ada_params = {"adaboostclassifier__n_estimators": np.arange(1, 50, 1),
              "adaboostclassifier__learning_rate": np.arange(0.01, 1, 0.1)}

ada = AdaBoostClassifier
scaler_pipe = make_pipeline(StandardScaler(), AdaBoostClassifier())
grid = GridSearchCV(scaler_pipe, param_grid=ada_params, cv=cv)


ada_grid = GridSearchCV(AdaBoostClassifier(), param_grid=ada_params, cv=cv,
                        scoring="roc_auc")
ada_grid.fit(X, y)

ada = ada_grid.best_estimator_

scores = cross_val_score(ada, X, y, cv=cv, scoring="roc_auc")<commit_msg>fixed error<commit_after>import numpy as np
import pandas as pd
from my_settings import *

from sklearn.ensemble import AdaBoostClassifier
from sklearn.cross_validation import StratifiedShuffleSplit, cross_val_score
from sklearn.grid_search import GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline

data = pd.read_csv(data_path +
                   "alpha_mean_pow_data_extracted_phase_target.csv")
data = data.drop("mean", 1)
data["corr"], corr_lbl = pd.factorize(data.correct)

data_dv = pd.get_dummies(data[["ROI", "condition_side",
                               "condition_type", "phase"]])
data_dv["pow"] = data.power

data_itc = pd.read_csv(data_path +
                       "alpha_mean_itc_data_extracted_phase_target.csv")
data_itc = data_itc.drop("mean", 1)

data_dv["itc"] = data_itc["itc"]

y = data["corr"].get_values()
X = data_dv.get_values()


cv = StratifiedShuffleSplit(y, n_iter=10)
ada_params = {"adaboostclassifier__n_estimators": np.arange(1, 50, 1),
              "adaboostclassifier__learning_rate": np.arange(0.01, 1, 0.1)}

ada = AdaBoostClassifier
scaler_pipe = make_pipeline(StandardScaler(), AdaBoostClassifier())
grid = GridSearchCV(scaler_pipe, param_grid=ada_params, cv=cv)

ada_grid.fit(X, y)

ada = ada_grid.best_estimator_

scores = cross_val_score(ada, X, y, cv=cv, scoring="roc_auc")

{'fraction_non_alphanumeric': 0.1122976231484671, 'fraction_numerical': 0.009645194626248708, 'mean_word_length': 4.819639278557114, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1755363', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1016, 'n_words': 188}