forked from s18k/Active-Learning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.py
52 lines (46 loc) · 1.55 KB
/
data.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
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
class Data:
__data = None
@staticmethod
def getData():
if Data.__data == None:
print("Here")
Data()
return Data.__data
def __init__(self,counter,X_pool,y_pool,learner,committee,accuracy,X_test,y_test,classlist,queries):
print("Inint called")
self.counter = counter
self.X_pool = X_pool
self.y_pool = y_pool
self.learner = learner
self.committee = committee
self.accuracy = list(accuracy)
self.X_test = X_test
self.y_test = y_test
self.classlist = classlist
self.queries = queries
print(type(accuracy))
Data.__data = self
def setdata(self,params):
self.counter = params["counter"]
self.X_pool = params["X_pool"]
self.y_pool = params["y_pool"]
print(params["accuracy"])
print(self.accuracy)
list = self.accuracy
list.append(params["accuracy"])
self.accuracy = list
# self.accuracy = list(list(self.accuracy).append(params["accuracy"]))
print(self.accuracy)
Data.__data = self
def givedata(self):
params={}
params["counter"] = self.counter
params["X_pool"] = self.X_pool
params["y_pool"] = self.y_pool
params["learner"] = self.learner
params["committee"] = self.committee
params["accuracy"] = self.accuracy
return params