aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGertjan van den Burg <burg@ese.eur.nl>2016-09-30 20:16:10 +0200
committerGertjan van den Burg <burg@ese.eur.nl>2016-09-30 20:16:10 +0200
commit2c6c5a9b28deaeeaf36477e154afd5192a0bab0c (patch)
treece9e62f662314d59760510c50c1dbeaab5b266f5
parentminor changes and start on test of gensvm_optimize (diff)
downloadgensvm-2c6c5a9b28deaeeaf36477e154afd5192a0bab0c.tar.gz
gensvm-2c6c5a9b28deaeeaf36477e154afd5192a0bab0c.zip
remove unnecessary W and t matrices
-rw-r--r--include/gensvm_base.h4
-rw-r--r--src/gensvm_base.c9
-rw-r--r--src/gensvm_optimize.c13
3 files changed, 2 insertions, 24 deletions
diff --git a/include/gensvm_base.h b/include/gensvm_base.h
index 0366edf..ded0149 100644
--- a/include/gensvm_base.h
+++ b/include/gensvm_base.h
@@ -74,10 +74,6 @@ struct GenModel {
///< parameter for the Huber hinge function
double lambda;
///< regularization parameter in the loss function
- double *W;
- ///< weight matrix
- double *t;
- ///< translation vector
double *V;
///< augmented weight matrix
double *Vbar;
diff --git a/src/gensvm_base.c b/src/gensvm_base.c
index 3e2dfeb..7710fc9 100644
--- a/src/gensvm_base.c
+++ b/src/gensvm_base.c
@@ -88,8 +88,6 @@ struct GenModel *gensvm_init_model()
model->kerneltype = K_LINEAR;
model->kernelparam = NULL;
- model->W = NULL;
- model->t = NULL;
model->V = NULL;
model->Vbar = NULL;
model->U = NULL;
@@ -119,8 +117,6 @@ void gensvm_allocate_model(struct GenModel *model)
long m = model->m;
long K = model->K;
- model->W = Calloc(double, m*(K-1));
- model->t = Calloc(double, K-1);
model->V = Calloc(double, (m+1)*(K-1));
model->Vbar = Calloc(double, (m+1)*(K-1));
model->U = Calloc(double, K*(K-1));
@@ -169,9 +165,6 @@ void gensvm_reallocate_model(struct GenModel *model, long n, long m)
model->n = n;
}
if (model->m != m) {
- model->W = Realloc(model->W, double, m*(K-1));
- Memset(model->W, double, m*(K-1));
-
model->V = Realloc(model->V, double, (m+1)*(K-1));
Memset(model->V, double, (m+1)*(K-1));
@@ -197,8 +190,6 @@ void gensvm_free_model(struct GenModel *model)
if (model == NULL)
return;
- free(model->W);
- free(model->t);
free(model->V);
free(model->Vbar);
free(model->U);
diff --git a/src/gensvm_optimize.c b/src/gensvm_optimize.c
index aa9dcbf..19e697e 100644
--- a/src/gensvm_optimize.c
+++ b/src/gensvm_optimize.c
@@ -41,8 +41,8 @@
*/
void gensvm_optimize(struct GenModel *model, struct GenData *data)
{
- long i, j, it = 0;
- double L, Lbar, value;
+ long it = 0;
+ double L, Lbar;
long n = model->n;
long m = model->m;
@@ -102,15 +102,6 @@ void gensvm_optimize(struct GenModel *model, struct GenData *data)
note("Number of support vectors: %li\n", gensvm_num_sv(model));
model->training_error = (Lbar - L)/L;
-
- for (i=0; i<K-1; i++)
- model->t[i] = matrix_get(model->V, K-1, 0, i);
- for (i=1; i<m+1; i++) {
- for (j=0; j<K-1; j++) {
- value = matrix_get(model->V, K-1, i, j);
- matrix_set(model->W, K-1, i-1, j, value);
- }
- }
free(B);
free(ZV);
free(ZAZ);