Skip to content

Instantly share code, notes, and snippets.

@dsal1951
Last active July 9, 2016 19:12
Show Gist options
  • Save dsal1951/297d153d0a32447d927de34a75268298 to your computer and use it in GitHub Desktop.
Save dsal1951/297d153d0a32447d927de34a75268298 to your computer and use it in GitHub Desktop.
#Create dataset
x,y = datasets.make_classification(n_samples=10000, n_features=20,
n_informative=15,n_redundant=5,
n_classes=2, weights=[0.95,0.05],
random_state=1000)
#Split into Training and Test sets
x_train, x_test, y_train, y_test = cross_validation.train_test_split(x,y,
test_size=0.3,random_state=1000)
#Train a Decision Tree to Predict y
clf = tree.DecisionTreeClassifier(min_samples_leaf=10)
clf.fit(x_train,y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment