forked from seg/2016-ml-contest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b35e87b
commit 22bdc81
Showing
4 changed files
with
58 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
# coding: utf-8 | ||
|
||
# # Machine Learning Contest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import numpy as np | ||
|
||
from sklearn.ensemble import ExtraTreesClassifier, VotingClassifier | ||
from sklearn.model_selection import train_test_split | ||
from sklearn.pipeline import make_pipeline, make_union | ||
from sklearn.preprocessing import FunctionTransformer | ||
|
||
# NOTE: Make sure that the class is labeled 'class' in the data file | ||
tpot_data = np.recfromcsv('PATH/TO/DATA/FILE', delimiter='COLUMN_SEPARATOR', dtype=np.float64) | ||
features = np.delete(tpot_data.view(np.float64).reshape(tpot_data.size, -1), tpot_data.dtype.names.index('class'), axis=1) | ||
training_features, testing_features, training_classes, testing_classes = \ | ||
train_test_split(features, tpot_data['class'], random_state=42) | ||
|
||
exported_pipeline = make_pipeline( | ||
ExtraTreesClassifier(criterion="gini", max_features=0.53, n_estimators=500) | ||
) | ||
|
||
exported_pipeline.fit(training_features, training_classes) | ||
results = exported_pipeline.predict(testing_features) |
Binary file not shown.