aboutsummaryrefslogtreecommitdiff
path: root/src/gensvm_pred.c
diff options
context:
space:
mode:
authorGertjan van den Burg <burg@ese.eur.nl>2016-10-17 13:41:46 +0200
committerGertjan van den Burg <burg@ese.eur.nl>2016-10-17 13:41:46 +0200
commite2c0ca1c082bfd7755c7af5bc5c9021bce64f3ba (patch)
tree3564a0b9ed66ccf71d16bf54a304aad320876bbf /src/gensvm_pred.c
parentupdate doxyfile (diff)
downloadgensvm-e2c0ca1c082bfd7755c7af5bc5c9021bce64f3ba.tar.gz
gensvm-e2c0ca1c082bfd7755c7af5bc5c9021bce64f3ba.zip
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
Diffstat (limited to 'src/gensvm_pred.c')
-rw-r--r--src/gensvm_pred.c19
1 files changed, 2 insertions, 17 deletions
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