-
Notifications
You must be signed in to change notification settings - Fork 79
/
example.py
58 lines (30 loc) · 1.08 KB
/
example.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
53
54
55
56
57
58
import random
from hunga_bunga import HungaBungaClassifier, HungaBungaRegressor, HungaBungaZeroKnowledge, HungaBungaRandomClassifier, HungaBungaRandomRegressor
from hunga_bunga.regression import gen_reg_data
from sklearn import datasets
# ---------- Getting The Data ----------
iris = datasets.load_iris()
X_c, y_c = iris.data, iris.target
X_r, y_r = gen_reg_data(10, 3, 100, 3, sum, 0.3)
# ---------- Brute-Force Classification ----------
clf = HungaBungaClassifier()
clf.fit(X_c, y_c)
print(clf.predict(X_c))
# ---------- Random Classification ----------
clf = HungaBungaRandomClassifier()
clf.fit(X_c, y_c)
print(clf.predict(X_c))
# ---------- Brute-Force Regression ----------
mdl = HungaBungaRegressor()
mdl.fit(X_r, y_r)
print(mdl.predict(X_c))
# ---------- Random Regression ----------
mdl = HungaBungaRandomRegressor()
mdl.fit(X_r, y_r)
print(mdl.predict(X_c))
# ---------- Zero Knowledge ----------
X, y = random.choice(((X_c, y_c), (X_r, y_r)))
mdl = HungaBungaZeroKnowledge()
mdl.fit(X, y)
print(mdl.predict(X), mdl.problem_type)
# <3 Dean, this is 4 U <3