GenSVM
Functions
gensvm_predict.c File Reference

Main functions for predicting class labels.. More...

#include "gensvm_predict.h"
Include dependency graph for gensvm_predict.c:

Go to the source code of this file.

Functions

void gensvm_predict_labels (struct GenData *testdata, struct GenModel *model, long *predy)
 Predict class labels of data given and output in predy. More...
 
double gensvm_prediction_perf (struct GenData *data, long *predy)
 Calculate the predictive performance (percentage correct) More...
 

Detailed Description

Main functions for predicting class labels..

Author
G.J.J. van den Burg
Date
2013-08-09

This file contains functions for predicting the class labels of instances and a function for calculating the predictive performance (hitrate) of a prediction given true class labels.

This file is part of GenSVM.

GenSVM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GenSVM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GenSVM. If not, see http://www.gnu.org/licenses/.

Definition in file gensvm_predict.c.

Function Documentation

◆ gensvm_predict_labels()

void gensvm_predict_labels ( struct GenData testdata,
struct GenModel model,
long *  predy 
)

Predict class labels of data given and output in predy.

The labels are predicted by mapping each instance in data to the simplex space using the matrix V in the given model. Next, for each instance the nearest simplex vertex is determined using an Euclidean norm. The nearest simplex vertex determines the predicted class label, which is recorded in predy.

Parameters
[in]testdataGenData to predict labels for
[in]modelGenModel with optimized V
[out]predypre-allocated vector to record predictions in

Definition at line 48 of file gensvm_predict.c.

Here is the call graph for this function:

◆ gensvm_prediction_perf()

double gensvm_prediction_perf ( struct GenData data,
long *  predy 
)

Calculate the predictive performance (percentage correct)

The predictive performance is calculated by simply counting the number of correctly classified samples and dividing by the total number of samples, multiplying by 100.

Parameters
[in]datathe GenData dataset with known labels
[in]predythe predicted class labels
Returns
percentage correctly classified.

Definition at line 105 of file gensvm_predict.c.