In [2]:
from IPython.core.display import HTML
import os
def css_styling():
"""Load default custom.css file from ipython profile"""
base = os.getcwd()
styles = "<style>\n%s\n</style>" % (open(os.path.join(base,'files/custom.css'),'r').read())
return HTML(styles)
css_styling()
Out[2]:
In [3]:
import pandas as pd
import numpy as np
In [4]:
df = pd.read_csv('training.csv')
In [5]:
df.head(1)
Out[5]:
In [6]:
bueno=df['Label'].replace(to_replace=['s','b'],value=[1,0])
df['class_int']= bueno
In [7]:
df.drop('EventId',axis=1,inplace=True)
df.drop('Label',axis=1,inplace=True)
df.drop('class_int',axis=1,inplace=True)
In [8]:
X = df.values
Y = bueno
In [9]:
print(X.shape)
print(Y.shape)
In [11]:
X_train,X_test, Y_train, Y_test= train_test_split(X,Y,test_size=0.95)
In [10]:
print(X_train.shape)
print(Y_train.shape)
In [ ]:
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier(
max_features=3,
max_depth=10,
min_samples_leaf=50,
n_estimators=5
)
clf.fit(X_train,Y_train)
clf.score(X_test,Y_test)
In [1]:
from sklearn.ensemble import GradientBoostingClassifier as GBC
In [ ]: