-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgenboost_classifier_krr.py
More file actions
37 lines (29 loc) · 960 Bytes
/
genboost_classifier_krr.py
File metadata and controls
37 lines (29 loc) · 960 Bytes
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
import numpy as np
from sklearn.datasets import load_digits, load_breast_cancer, load_wine, load_iris, load_diabetes
from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_score
from time import time
from os import chdir
from sklearn import metrics
import os
print(f"\n ----- Running: {os.path.basename(__file__)}... ----- \n")
import mlsauce as ms
#ridge
print("\n")
print("GenericBoosting KernelRidge -----")
print("\n")
# data 1
dataset = load_wine()
X = dataset.data
y = dataset.target
# split data into training test and test set
np.random.seed(15029)
X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.2)
clf = ms.KRLSRegressor()
obj = ms.GenericBoostingClassifier(clf)
print(obj.get_params())
start = time()
obj.fit(X_train, y_train)
print("Elapsed", time()-start)
pred = obj.predict(X_test)
print("Accuracy", metrics.accuracy_score(y_test, pred))