#2 Add predict and score support

Add a test in features notebook
Show max_features in main.py
This commit is contained in:
2020-06-14 14:00:21 +02:00
parent f1ee4de37b
commit 502ee72799
4 changed files with 82 additions and 14 deletions

View File

@@ -12,6 +12,15 @@ Xtrain, Xtest, ytrain, ytest = train_test_split(
)
now = time.time()
print("Predicting with max_features=sqrt(n_features)")
clf = Stree(C=0.01, random_state=random_state, max_features="auto")
clf.fit(Xtrain, ytrain)
print(f"Took {time.time() - now:.2f} seconds to train")
print(clf)
print(f"Classifier's accuracy (train): {clf.score(Xtrain, ytrain):.4f}")
print(f"Classifier's accuracy (test) : {clf.score(Xtest, ytest):.4f}")
print("=" * 40)
print("Predicting with max_features=n_features")
clf = Stree(C=0.01, random_state=random_state)
clf.fit(Xtrain, ytrain)
print(f"Took {time.time() - now:.2f} seconds to train")