-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_computer.py
63 lines (51 loc) · 2.19 KB
/
base_computer.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
59
60
61
62
63
class BaseComputer:
def __init__(self):
"""
Initializes the BaseComputer object. This is the base class for all computer objects.
Parameters:
None
Returns:
None
"""
self.training = False
def trigger_training(self, training):
"""
Triggers the training process by setting the training attribute to true or false.
Args:
training (boolean): A boolean value indicating whether the training process should be triggered.
Returns:
None
"""
self.training = training
@property
def is_independent(self):
"""
Check if the object returns independent results, i.e., if
the resulting values are independent of each other.
Returns:
bool: True if the object is independent, False otherwise.
"""
return True
def fit(self, questions, model_answers, measure):
"""
Fits the model to the given questions and model answers using the specified measure.
Args:
questions (list): A list of questions.
model_answers (list): A list of model answers corresponding to the questions.
measure (list): The value of the measure for each model answer.
"""
raise NotImplementedError
def predict(self, questions, model_answers=None):
"""
Make predictions based on the given questions.
Args:
questions (list): A list of questions to make predictions on.
model_answers (list, optional): A list of model answers to make predictions on. Defaults to None.
Raises:
NotImplementedError: This method needs to be implemented in a derived class.
Returns:
list: A list of predictions. Each question should have a corresponding prediction for each model.
list: A list of uncertainties. Each question should have a corresponding uncertainty matrix, indicating the variances and covariances of the predictions.
If the uncertainty is None, the prediction is considered to be deterministic.
"""
raise NotImplementedError