|
10 | 10 | parser = argparse.ArgumentParser(description='scikit-learn DBSCAN benchmark')
|
11 | 11 | parser.add_argument('-x', '--filex', '--fileX', '--input', required=True,
|
12 | 12 | type=str, help='Points to cluster')
|
13 |
| -parser.add_argument('-e', '--eps', '--epsilon', type=float, default=0.5, |
| 13 | +parser.add_argument('-e', '--eps', '--epsilon', type=float, default=10, |
14 | 14 | help='Radius of neighborhood of a point')
|
15 | 15 | parser.add_argument('-m', '--data-multiplier', default=100,
|
16 | 16 | type=int, help='Data multiplier')
|
17 | 17 | parser.add_argument('-M', '--min-samples', default=5, type=int,
|
18 | 18 | help='The minimum number of samples required in a '
|
19 | 19 | 'neighborhood to consider a point a core point')
|
20 |
| -params = parse_args(parser, loop_types=('fit', 'predict'), n_jobs_supported=True) |
| 20 | +params = parse_args(parser, n_jobs_supported=True) |
21 | 21 |
|
22 | 22 | # Load generated data
|
23 | 23 | X = np.load(params.filex)
|
|
38 | 38 | print_header(columns, params)
|
39 | 39 |
|
40 | 40 | # Time fit
|
41 |
| -fit_time, _ = time_mean_min(dbscan.fit, X, |
42 |
| - outer_loops=params.fit_outer_loops, |
43 |
| - inner_loops=params.fit_inner_loops, |
44 |
| - goal_outer_loops=params.fit_goal, |
45 |
| - time_limit=params.fit_time_limit, |
46 |
| - verbose=params.verbose) |
47 |
| -params.n_clusters = len(dbscan.core_sample_indices_) |
48 |
| -print_row(columns, params, function='DBSCAN.fit', time=fit_time) |
49 |
| - |
50 |
| -# Time predict |
51 |
| -predict_time, _ = time_mean_min(dbscan.fit_predict, X, |
52 |
| - outer_loops=params.predict_outer_loops, |
53 |
| - inner_loops=params.predict_inner_loops, |
54 |
| - goal_outer_loops=params.predict_goal, |
55 |
| - time_limit=params.predict_time_limit, |
56 |
| - verbose=params.verbose) |
57 |
| -print_row(columns, params, function='DBSCAN.fit_predict', time=predict_time) |
| 41 | +time, _ = time_mean_min(dbscan.fit, X, |
| 42 | + outer_loops=params.outer_loops, |
| 43 | + inner_loops=params.inner_loops, |
| 44 | + goal_outer_loops=params.goal, |
| 45 | + time_limit=params.time_limit, |
| 46 | + verbose=params.verbose) |
| 47 | +labels = dbscan.labels_ |
| 48 | +params.n_clusters = len(set(labels)) - (1 if -1 in labels else 0) |
| 49 | +print_row(columns, params, function='DBSCAN', time=time) |
0 commit comments