add _linear_function to Stree

First try to implement predict_proba with sigmoid based on Platt
This commit is contained in:
2020-05-16 20:34:03 +02:00
parent 80b5cf8e72
commit 6a8ef288ce
6 changed files with 197 additions and 18 deletions

View File

@@ -35,7 +35,7 @@ def load_creditcard(n_examples=0):
return X, y
#X, y = load_creditcard(-5000)
#X, y = load_creditcard()
X, y = load_creditcard()
#X, y = load_creditcard()
clf = Stree(C=.01, max_iter=100, random_state=random_state)
clf.fit(X, y)
@@ -46,3 +46,4 @@ yp = clf.predict_proba(X[0, :].reshape(-1, X.shape[1]))
print(f"Predicting {y[0]} we have {yp[0, 0]} with {yp[0, 1]} of belief")
print(f"Classifier's accuracy: {clf.score(X, y, print_out=False):.4f}")
clf.show_tree(only_leaves=True)
print(clf.predict_proba(X))