Skip to content

Commit a975514

Browse files
committed
eval
1 parent f7001e1 commit a975514

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Diff for: Supervised_learn/Estimate_eval.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Wed Aug 8 19:19:17 2018
4+
5+
@author: Administrator
6+
"""
7+
8+
from sklearn.datasets import make_moons
9+
from sklearn.model_selection import train_test_split
10+
import numpy as np
11+
from sklearn.ensemble import GradientBoostingClassifier
12+
from sklearn.datasets import make_circles
13+
from sklearn.datasets import load_iris
14+
15+
def Uncertainty_eval():
16+
'''test'''
17+
X, y= make_circles(noise=0.25, factor=0.5, random_state=1)
18+
19+
y = np.array(["blue", "red"])[y]
20+
X_train, X_test, y_train, y_test = train_test_split(
21+
X, y ,random_state=0)
22+
23+
gb = GradientBoostingClassifier(learning_rate=0.01,random_state=0)
24+
gb.fit(X_train, y_train)
25+
print("Decusuib functions: \n{}".format(gb.decision_function(X_test)[:6]))
26+
print(gb.classes_)
27+
print("Decusuib functions: \n{}".format(gb.predict_proba(X_test)[:6]))
28+
29+
iris = load_iris()
30+
X_train, X_test, y_train, y_test = train_test_split(
31+
iris.data, iris.target ,random_state=42)
32+
gb.fit(X_train, y_train)
33+
print(gb.score(X_test,y_test) ,'\n', np.argmax(gb.predict_proba(X_test),axis=1))

0 commit comments

Comments
 (0)