# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
# %%time
import pandas as pd
import numpy as np
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from itertools import combinations 
from mlxtend.classifier import StackingClassifier
from sklearn import model_selection


# -

# %%time
train = pd.read_csv("1_min_train.csv")
test = pd.read_csv("1_min_test.csv")

print(train.shape)
print(test.shape)

features=train.columns.tolist()
features = features[3:]
features

clf1 = ExtraTreesClassifier(n_estimators=50, n_jobs=10, verbose=1,random_state=0)
clf2 = DecisionTreeClassifier()
clf3 = RandomForestClassifier(n_estimators=10)
clf4 = LogisticRegression()

sclf = StackingClassifier(classifiers=[clf1, clf2, clf3], meta_classifier=clf4)

for clf, label in zip([clf1, clf2, clf3, sclf], ['ExtraTreesClassifier','DecisionTreeClassifier','RandomForestClassifier','LogisticRegression']):

    scores = model_selection.cross_val_score(clf, test[features], test['target'],cv=3, scoring='accuracy')
    
    print("Accuracy: %0.2f (+/- %0.2f) [%s]" % (scores.mean(), scores.std(), label))



StarcoderdataJupyterScriptsDedupFiltered