From e2c0ca1c082bfd7755c7af5bc5c9021bce64f3ba Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Mon, 17 Oct 2016 13:41:46 +0200 Subject: Update predictions to work with sparse matrices This is done by pulling the Z*V routines from the gensvm_optimize file to a seperate file, since they are shared by prediction and get_loss --- src/gensvm_pred.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src/gensvm_pred.c') diff --git a/src/gensvm_pred.c b/src/gensvm_pred.c index afa1ab9..31b591c 100644 --- a/src/gensvm_pred.c +++ b/src/gensvm_pred.c @@ -30,13 +30,12 @@ void gensvm_predict_labels(struct GenData *testdata, struct GenModel *model, long *predy) { - long i, j, k, n, m, K, label; + long i, j, k, n, K, label; double norm, min_dist, *S = NULL, *ZV = NULL; n = testdata->n; - m = testdata->r; K = model->K; // allocate necessary memory @@ -47,21 +46,7 @@ void gensvm_predict_labels(struct GenData *testdata, struct GenModel *model, gensvm_simplex(model); // Generate the simplex space vectors - cblas_dgemm( - CblasRowMajor, - CblasNoTrans, - CblasNoTrans, - n, - K-1, - m+1, - 1.0, - testdata->Z, - m+1, - model->V, - K-1, - 0.0, - ZV, - K-1); + gensvm_calculate_ZV(model, testdata, ZV); // Calculate the distance to each of the vertices of the simplex. // The closest vertex defines the class label -- cgit v1.2.3