Stratify test split (+0.25 points)
This commit is contained in:
parent
5e1ae3289b
commit
ee039552d2
@ -20,7 +20,7 @@ df.drop(['flowStartMilliseconds'], 1, inplace=True)
|
|||||||
X = np.array(df.drop(columns=['sublabel']))
|
X = np.array(df.drop(columns=['sublabel']))
|
||||||
y = np.array(df['sublabel'])
|
y = np.array(df['sublabel'])
|
||||||
|
|
||||||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
|
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, stratify=y)
|
||||||
|
|
||||||
clf = RandomForestClassifier(n_estimators=50, n_jobs=-1, criterion='gini', random_state=0)
|
clf = RandomForestClassifier(n_estimators=50, n_jobs=-1, criterion='gini', random_state=0)
|
||||||
clf.fit(X_train, y_train)
|
clf.fit(X_train, y_train)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user