-
Notifications
You must be signed in to change notification settings - Fork 0
/
predict.py
39 lines (24 loc) · 1.26 KB
/
predict.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
import pandas as pd
import joblib
def read_samples(path):
samples = pd.read_csv(path, index_col= 0)
return samples
def load_models(path):
African_model = joblib.load(path + 'African_model.pkl')
SouthAsian_model = joblib.load(path + 'SouthAsian_model.pkl')
EastAsian_model = joblib.load(path + 'EastAsian_model.pkl')
European_model = joblib.load(path + 'European_model.pkl')
American_model = joblib.load(path + 'American_model.pkl')
return African_model, SouthAsian_model, EastAsian_model, European_model, American_model
if __name__ == '__main__':
path = 'data_training/samples.csv'
samples = read_samples(path)
African_model, SouthAsian_model, EastAsian_model, European_model, American_model = load_models('models/')
African_pred = African_model.predict(samples)
SouthAsian_pred = SouthAsian_model.predict(samples)
EastAsian_pred = EastAsian_model.predict(samples)
European_pred = European_model.predict(samples)
American_pred = American_model.predict(samples)
preds = [African_pred, SouthAsian_pred, EastAsian_pred, European_pred, American_pred]
results = pd.DataFrame(preds, index=['AFR', 'SAS', 'EAS', 'EUR', 'AMR'], columns=samples.index).T
print(results)