- cur.execute("SELECT conf, value FROM measure WHERE result='nominal' AND toolgit IN (1, 11);")
- measurements = cur.fetchall()
-
- options = load_variable_options(measurements)
- configs = load_configs(measurements, options)
-
- options = remove_linerly_dependent_options(options, measurements, configs)
- save_options(options)
-
- (A,B) = construct_ab(options, measurements, configs)
-
- #np.set_printoptions(threshold = float('nan'), linewidth = 300)
- np.set_printoptions(edgeitems = 9, linewidth = 80)
-# print(A)
-# print(B)
- result = nplag.lstsq(A, B)
-
- x=np.mat(result[0])
- try:
- results = pickle.load(open('results.pickle', 'rb'))
- except:
- results = []
- for k in options:
- print(k)
- idx = options[k]
- r = OptionResult(k, regression=x.item(idx), yes_count=A[:,idx].sum())
- r.calc_measure_diff(A, B, options)
-
- results.append(r)
- results.sort(key=lambda r: r.regression)
- pickle.dump(results, open('results.pickle', 'wb'))
-
- for r in results:
- print("{option_name:<40} {regression:7.2f} {yes_count:4d} {percent:2}%".format(percent=10, **r.__dict__))
- print("%-40s %6.2f" % ("common", x[len(options)]))
- print(A.shape)
-
- plot_values(measurements, configs, A*x, [r.option_name for r in results])
- plot_bars(results)
+ cur.execute("SELECT conf, value FROM measure WHERE result='nominal' AND toolgit IN (1, 11);")
+ measurements = cur.fetchall()
+
+ try:
+ measure_diff = json.load(open('measure_diff.json', 'r'))
+ except:
+ measure_diff = calc_measure_diff(measurements)
+ json.dump(measure_diff, open('measure_diff.json', 'w'), indent="\t", sort_keys=True)
+
+ options = load_variable_options(measurements)
+ configs = load_configs(measurements, options)
+
+ options = remove_linerly_dependent_options(options, measurements, configs)
+# save_options(options)
+
+ (A,B) = construct_ab(options, measurements, configs)
+
+ #np.set_printoptions(threshold = float('nan'), linewidth = 300)
+ np.set_printoptions(edgeitems = 9, linewidth = 80)
+# print(A)
+# print(B)
+ result = nplag.lstsq(A, B)
+
+ x=np.mat(result[0])
+
+ results = []
+ for k in options:
+ idx = options[k]
+ r = OptionResult(k, regression=x.item(idx), yes_count=A[:,idx].sum())
+ r.measure_diff = measure_diff[k]
+ results.append(r)
+ results.sort(key=lambda r: r.regression)
+
+ for r in results:
+ print("{option_name:<40} {regression:7.2f} {yes_count:4d} {percent:3.0f}%".format(percent=100*r.yes_count/len(measurements), **r.__dict__))
+ print("%-40s %7.2f" % ("common", x[len(options)]))
+ plot_values(measurements, configs, A*x, [r.option_name for r in results])
+
+ print(A.shape)
+
+ plot_bars(results)