-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild_rankings.py
More file actions
27 lines (21 loc) · 837 Bytes
/
build_rankings.py
File metadata and controls
27 lines (21 loc) · 837 Bytes
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
from Utils.file_loader import get_dataframes, get_generated_dataframes
from multiprocessing import Pool
from run_clustering import main as write_measures
import pandas as pd
import pickle
import os
import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning)
def main():
dataframes = get_dataframes()
generated_dfs = get_generated_dataframes()
total_dfs = dataframes + generated_dfs
final_results = []
with Pool(8) as p:
for x in p.map(write_measures, total_dfs):
final_results.append(x)
pickle.dump(final_results, open(os.path.join(os.getcwd(), 'results.pkl'), 'wb'))
df = pd.DataFrame.from_records(final_results, columns=['dbscan', 'mst', 'SL', 'eac', 'khmeans', 'kmeans', 'psc', 'dataset'])
df.to_csv('rankings.csv')
if __name__ == "__main__":
main()