Mercurial > hg > plosone_underreview
comparison notebooks/sensitivity_experiment_server_mapper.py @ 48:08b9327f1935 branch-tests
mapper now writes output
author | mpanteli <m.x.panteli@gmail.com> |
---|---|
date | Fri, 15 Sep 2017 17:46:45 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
47:081ff4ea7da7 | 48:08b9327f1935 |
---|---|
1 import numpy as np | |
2 import pandas as pd | |
3 import sys | |
4 sys.path.append('../') | |
5 import scripts.load_dataset as load_dataset | |
6 import scripts.map_and_average as mapper | |
7 import scripts.classification as classification | |
8 import scripts.outliers as outliers | |
9 | |
10 #df = load_dataset.sample_dataset(csv_file=load_dataset.METADATA_FILE) | |
11 OUTPUT_FILES = load_dataset.OUTPUT_FILES | |
12 n_iters = 1 | |
13 n = int(sys.argv[1]) | |
14 MAPPER_OUTPUT_FILES = mapper.OUTPUT_FILES | |
15 | |
16 #for n in range(n_iters): | |
17 if 1: | |
18 print "iteration %d" % n | |
19 | |
20 print "mapping..." | |
21 mapper.INPUT_FILES = [output_file.split('.pickle')[0]+'_'+str(n)+'.pickle' for | |
22 output_file in OUTPUT_FILES] | |
23 _, _, ldadata_list, _, _, Y, Yaudio = mapper.lda_map_and_average_frames(min_variance=0.99) | |
24 mapper.OUTPUT_FILES = [output_file.split('.pickle')[0]+'_'+str(n)+'.pickle' for | |
25 output_file in MAPPER_OUTPUT_FILES] | |
26 mapper.write_output([], [], ldadata_list, [], [], Y, Yaudio) | |
27 | |
28 #X = np.concatenate(ldadata_list, axis=1) | |
29 | |
30 ## classification and confusion | |
31 #print "classifying..." | |
32 #traininds, testinds = classification.get_train_test_indices(Yaudio) | |
33 #X_train, Y_train, X_test, Y_test = classification.get_train_test_sets(X, Y, traininds, testinds) | |
34 #accuracy, _ = classification.confusion_matrix(X_train, Y_train, X_test, Y_test, saveCF=False, plots=False) | |
35 #print accuracy | |
36 | |
37 ## outliers | |
38 #print "detecting outliers..." | |
39 #df_global, threshold, MD = outliers.get_outliers_df(X, Y, chi2thr=0.999) | |
40 #outliers.print_most_least_outliers_topN(df_global, N=10) | |
41 | |
42 ## write output | |
43 #print "writing file" | |
44 #df_global.to_csv('../data/outliers_'+str(n)+'.csv', index=False) |