-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_file4.py
53 lines (32 loc) · 1.37 KB
/
test_file4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import model_vistraining
import numpy as np
import sklearn.datasets as datasets
from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegression
"""
this file gives a example of how to use this project to preform training
visualization.
This is a test of when using feature and target
"""
cancer = datasets.load_breast_cancer()
feature,target = cancer.data,cancer.target
class LogisticRegressionWarpper:
def __init__(self,C = 1,penalty = "l2"):
self.LogisticRegression = LogisticRegression(C=C,penalty = penalty)
def fit(self,X,y):
self.LogisticRegression.fit(X,y)
return self
def predict_proba(self,X):
return self.LogisticRegression.predict_proba(X)[:,1]
base = model_vistraining.Base(model = LogisticRegressionWarpper,
parameter_dict = {"C":[0.1,0.3,0.5,0.7,0.9],
"penalty":["l2",None],
},
feature = feature,
target = target,
prediction_type="classification_proba",
predict_method="predict_proba")
base.GridSearch(time_for_each_param=5)
base.open_html_report()