-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCausalityPredictor.py
29 lines (26 loc) · 969 Bytes
/
CausalityPredictor.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
import data_io
import CausalityFeatureFunctions as f
class CausalityPredictor:
def getValidationDataset(self):
print "Reading the valid pairs"
valid = data_io.read_valid_pairs()
valid2 = data_io.read_valid_info()
valid["A type"] = valid2["A type"]
valid["B type"] = valid2["B type"]
return valid
def run(self):
valid = self.getValidationDataset()
if f.preprocessedFeatures != []:
intermediate = data_io.read_intermediate_valid()
for i in f.preprocessedFeatures:
valid[i] = intermediate[i]
print "Loading the classifier"
classifier = data_io.load_model()
print "Making predictions"
predictions = classifier.predict(valid)
predictions = predictions.flatten()
print "Writing predictions to file"
data_io.write_submission(predictions)
if __name__=="__main__":
cp = CausalityPredictor()
cp.run()