else: sdn = \ "%(dataset)s_%(count)d_%(limit)d_%(query_dataset)s_%(distance)s" % d cqf = datasets.get_query_cache_path( d["dataset"], d["count"], d["limit"], d["distance"], d["query_dataset"]) if not os.path.isfile(cqf): print """\ warning: query file "%s" is missing, skipping""" % cqf continue else: algo = d["algorithm"] if not cqf in query_cache: with open(cqf, "r") as fp: query_cache[cqf] = pickle.load(fp) ms, _ = compute_metrics(query_cache[cqf], [r]) ms = ms[algo] if not algo in all_runs_by_algorithm: all_runs_by_algorithm[algo] = {} algo_ds = d["dataset"] + " (k = " + str(d["count"]) + ")" if not algo_ds in all_runs_by_algorithm[algo]: all_runs_by_algorithm[algo][algo_ds] = [] all_runs_by_algorithm[algo][algo_ds].extend(ms) if not sdn in all_runs_by_dataset: all_runs_by_dataset[sdn] = {} dataset_information[sdn] = d if not algo in all_runs_by_dataset[sdn]: all_runs_by_dataset[sdn][algo] = [] all_runs_by_dataset[sdn][algo].extend(ms)
'--y-log', help='Draw the Y-axis using a logarithmic scale', action='store_true') parser.add_argument( '--raw', help='Show raw results (not just Pareto frontier) in faded colours', action='store_true') args = parser.parse_args() if not args.output: args.output = 'results/%s.png' % args.dataset print('writing output to %s' % args.output) dataset = get_dataset(args.dataset) dimension = len(dataset['train'][0]) # TODO(erikbern): ugly point_type = 'float' # TODO(erikbern): should look at the type of X_train distance = dataset.attrs['distance'] count = int(args.count) definitions = get_definitions(args.definitions, dimension, point_type, distance, count) unique_algorithms = get_unique_algorithms(args.definitions) linestyles = create_linestyles(unique_algorithms) results = load_results(args.dataset, count, definitions) runs = compute_metrics(list(dataset["distances"]), results, args.x_axis, args.y_axis) if not runs: raise Exception('Nothing to plot') create_plot(runs, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles)
action='store_true') parser.add_argument( '--raw', help='Show raw results (not just Pareto frontier) in faded colours', action='store_true') parser.add_argument('--batch', help='Plot runs in batch mode', action='store_true') parser.add_argument('--recompute', help='Clears the cache and recomputes the metrics', action='store_true') args = parser.parse_args() if not args.output: args.output = 'results/%s.png' % get_algorithm_name( args.dataset, args.batch) print('writing output to %s' % args.output) dataset = get_dataset(args.dataset) count = int(args.count) unique_algorithms = get_unique_algorithms() results = load_all_results(args.dataset, count, args.batch) linestyles = create_linestyles(sorted(unique_algorithms)) runs = compute_metrics(np.array(dataset["distances"]), results, args.x_axis, args.y_axis, args.recompute) if not runs: raise Exception('Nothing to plot') create_plot(runs, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles, args.batch)
action='store_true') parser.add_argument( '--raw', help='Show raw results (not just Pareto frontier) in faded colours', action='store_true') parser.add_argument('--batch', help='Plot runs in batch mode', action='store_true') parser.add_argument('--recompute', help='Clears the cache and recomputes the metrics', action='store_true') args = parser.parse_args() if not args.output: args.output = 'results/%s.png' % get_algorithm_name( args.dataset, args.batch) print('writing output to %s' % args.output) dataset = get_dataset(args.dataset) count = int(args.count) unique_algorithms = get_unique_algorithms() results = load_all_results(args.dataset, count, True, args.batch) linestyles = create_linestyles(sorted(unique_algorithms)) runs = compute_metrics(dataset, results, args.x_axis, args.y_axis, args.recompute) if not runs: raise Exception('Nothing to plot') create_plot(runs, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles, args.batch)
parser.add_argument( '-X', '--x-log', help='Draw the X-axis using a logarithmic scale', action='store_true') parser.add_argument( '-Y', '--y-log', help='Draw the Y-axis using a logarithmic scale', action='store_true') parser.add_argument( '--raw', help='Show raw results (not just Pareto frontier) in faded colours', action='store_true') args = parser.parse_args() if not args.output: args.output = 'results/%s.png' % args.dataset print('writing output to %s' % args.output) dataset = get_dataset(args.dataset) dimension = len(dataset['train'][0]) # TODO(erikbern): ugly point_type = 'float' # TODO(erikbern): should look at the type of X_train distance = dataset.attrs['distance'] definitions = get_definitions(args.definitions, dimension, point_type, distance, args.count) unique_algorithms = get_unique_algorithms(args.definitions) linestyles = create_linestyles(unique_algorithms) results = load_results(args.dataset, args.count, definitions) runs = compute_metrics(dataset, results, args.x_axis, args.y_axis) create_plot(runs, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles)
action='store_true') parser.add_argument( '-Y', '--y-log', help='Draw the Y-axis using a logarithmic scale', action='store_true') parser.add_argument( '--raw', help='Show raw results (not just Pareto frontier) in faded colours', action='store_true') args = parser.parse_args() if not args.output: args.output = 'results/%s.png' % args.dataset print('writing output to %s' % args.output) dataset = get_dataset(args.dataset) dimension = len(dataset['train'][0]) # TODO(erikbern): ugly point_type = 'float' # TODO(erikbern): should look at the type of X_train distance = dataset.attrs['distance'] count = int(args.count) definitions = get_definitions(args.definitions, dimension, point_type, distance, count) unique_algorithms = get_unique_algorithms(args.definitions) linestyles = create_linestyles(unique_algorithms) results = load_results(args.dataset, count, definitions) runs = compute_metrics(list(dataset["distances"]), results, args.x_axis, args.y_axis) if not runs: raise Exception('Nothing to plot') create_plot(runs, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles)
parser.add_argument('-X', '--x-log', help='Draw the X-axis using a logarithmic scale', action='store_true') parser.add_argument('-Y', '--y-log', help='Draw the Y-axis using a logarithmic scale', action='store_true') parser.add_argument('-G', '--golden', help='Use golden ratio as plotsize', action='store_true') parser.add_argument('--raw', help='Also show raw results in faded colours', action='store_true') args = parser.parse_args() dataset = get_dataset(args.dataset) dimension = len(dataset['train'][0]) # TODO(erikbern): ugly point_type = 'float' # TODO(erikbern): should look at the type of X_train distance = dataset.attrs['distance'] definitions = get_definitions(args.definitions, dimension, point_type, distance, args.count) results = load_results(args.dataset, args.count, definitions) runs, all_algos = compute_metrics(dataset, results) linestyles = create_linestyles(all_algos) create_plot(runs, args.golden, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles)
help='Draw the X-axis using a logarithmic scale', action='store_true') parser.add_argument( '-Y', '--y-log', help='Draw the Y-axis using a logarithmic scale', action='store_true') parser.add_argument( '-G', '--golden', help='Use golden ratio as plotsize', action='store_true') parser.add_argument( '--raw', help='Also show raw results in faded colours', action='store_true') args = parser.parse_args() query_cache_path = get_query_cache_path( args.dataset, args.count, args.limit, args.distance, args.query_dataset) assert os.path.exists(query_cache_path), """\ error: the query cache file \"%s\" does not exist""" % query_cache_path qs = pickle.load(open(query_cache_path)) runs, all_algos = compute_metrics(qs, get_results( args.dataset, args.limit, args.count, args.distance, args.query_dataset)) linestyles = create_linestyles(all_algos) create_plot(runs, args.golden, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles)
parser.add_argument('-y', '--y-axis', help='Which metric to use on the Y-axis', choices=metrics.keys(), default="qps") parser.add_argument('-X', '--x-log', help='Draw the X-axis using a logarithmic scale', action='store_true') parser.add_argument('-Y', '--y-log', help='Draw the Y-axis using a logarithmic scale', action='store_true') parser.add_argument('-G', '--golden', help='Use golden ratio as plotsize', action='store_true') parser.add_argument('--raw', help='Also show raw results in faded colours', action='store_true') args = parser.parse_args() dataset = get_dataset(args.dataset) distance = dataset.attrs['distance'] runs, all_algos = compute_metrics( dataset, get_results(args.dataset, args.count, distance)) linestyles = create_linestyles(all_algos) create_plot(runs, args.golden, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles)
help='Draw the X-axis using a logarithmic scale', action='store_true') parser.add_argument( '-Y', '--y-log', help='Draw the Y-axis using a logarithmic scale', action='store_true') parser.add_argument( '-G', '--golden', help='Use golden ratio as plotsize', action='store_true') parser.add_argument( '--raw', help='Also show raw results in faded colours', action='store_true') args = parser.parse_args() query_cache_path = get_query_cache_path( args.dataset, args.count, args.limit, args.distance, args.query_dataset) assert os.path.exists(query_cache_path), """\ error: the query cache file \"%s\" does not exist""" % query_cache_path qs = pickle.load(open(query_cache_path)) runs, all_algos = compute_metrics(qs, get_results( args.dataset, args.limit, args.count, args.distance, args.query_dataset)) linestyles = create_linestyles(all_algos) create_plot(runs, args.golden, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles)
help='Show raw results (not just Pareto frontier) in faded colours', action='store_true') parser.add_argument( '--batch', help='Plot runs in batch mode', action='store_true') parser.add_argument( '--recompute', help='Clears the cache and recomputes the metrics', action='store_true') args = parser.parse_args() if not args.output: args.output = 'results/%s.png' % get_algorithm_name( args.dataset, args.batch) print('writing output to %s' % args.output) dataset = get_dataset(args.dataset) count = int(args.count) unique_algorithms = get_unique_algorithms() results = load_all_results(args.dataset, count, True, args.batch) linestyles = create_linestyles(sorted(unique_algorithms)) runs = compute_metrics(np.array(dataset["distances"]), results, args.x_axis, args.y_axis, args.recompute) if not runs: raise Exception('Nothing to plot') create_plot(runs, args.raw, args.x_log, args.y_log, args.x_axis, args.y_axis, args.output, linestyles, args.batch)