diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-27 19:31:26 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-27 19:31:26 +0100 |
| commit | 527e1e0162a287d11b92be48eb22c5f98d6e59b8 (patch) | |
| tree | 8df244368fcbdf77e2a72860e879bda26c0f64d9 /src/gensvm_consistency.c | |
| parent | Major bugfix for nonlinear GenSVM (diff) | |
| download | gensvm-527e1e0162a287d11b92be48eb22c5f98d6e59b8.tar.gz gensvm-527e1e0162a287d11b92be48eb22c5f98d6e59b8.zip | |
Add support for predicting after grid search
With this commit the gensvm_grid executable can now compute
predictions with the best model found during the grid search.
The test dataset is supplied through the training file, and
a command line flag is added to support saving the predictions
in an output file.
Diffstat (limited to 'src/gensvm_consistency.c')
| -rw-r--r-- | src/gensvm_consistency.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gensvm_consistency.c b/src/gensvm_consistency.c index 07ff7a6..0aa33c0 100644 --- a/src/gensvm_consistency.c +++ b/src/gensvm_consistency.c @@ -124,8 +124,11 @@ struct GenQueue *gensvm_top_queue(struct GenQueue *q, double percentile) * configurations for consistency * @param[in] percentile percentile of performance to determine which * tasks to repeat + * + * @return ID of the best task + * */ -void gensvm_consistency_repeats(struct GenQueue *q, long repeats, +int gensvm_consistency_repeats(struct GenQueue *q, long repeats, double percentile) { bool breakout; @@ -229,11 +232,12 @@ void gensvm_consistency_repeats(struct GenQueue *q, long repeats, "mean_perf\tstd_perf\ttime_perf\n"); p = 0.0; breakout = false; - while (breakout == false) { + int best_id = -1; + while (!breakout) { pi = gensvm_percentile(mean, N, (100.0-p)); pr = gensvm_percentile(std, N, p); pt = gensvm_percentile(time, N, p); - for (i=0; i<N; i++) + for (i=0; i<N; i++) { if ((pi - mean[i] < 0.0001) && (std[i] - pr < 0.0001) && (time[i] - pt < 0.0001)) { @@ -251,7 +255,10 @@ void gensvm_consistency_repeats(struct GenQueue *q, long repeats, std[i], time[i]); breakout = true; + if (best_id == -1) + best_id = nq->tasks[i]->ID; } + } p += 1.0; } @@ -263,6 +270,8 @@ void gensvm_consistency_repeats(struct GenQueue *q, long repeats, free(std); free(mean); free(time); + + return best_id; } /** |
