aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gensvm_base.h16
-rw-r--r--include/gensvm_globals.h35
-rw-r--r--include/gensvm_grid.h24
-rw-r--r--include/gensvm_memory.h20
-rw-r--r--include/gensvm_predict.h4
-rw-r--r--include/gensvm_queue.h5
-rw-r--r--include/gensvm_task.h22
7 files changed, 104 insertions, 22 deletions
diff --git a/include/gensvm_base.h b/include/gensvm_base.h
index e97fab9..999bf2f 100644
--- a/include/gensvm_base.h
+++ b/include/gensvm_base.h
@@ -42,11 +42,12 @@
* @param K number of classes
* @param n number of instances
* @param m number of predictors
- * @param *y pointer to vector of class labels
- * @param *Z pointer to augmented data matrix
- * @param *spZ pointer to the sparse augmented data matrix
- * @param *RAW pointer to augmented raw data matrix
- * @param *J pointer to regularization vector
+ * @param y pointer to vector of class labels
+ * @param Z pointer to augmented data matrix
+ * @param spZ pointer to the sparse augmented data matrix
+ * @param RAW pointer to augmented raw data matrix
+ * @param J pointer to regularization vector
+ * @param Sigma eigenvalues from the reduced eigendecomposition
* @param kerneltype kerneltype used in GenData::Z
* @param *kernelparam kernel parameters used in GenData::Z
*
@@ -70,8 +71,13 @@ struct GenData {
double *RAW;
///< augmented raw data matrix
double *Sigma;
+ ///< eigenvalues from the reduced eigendecomposition
KernelType kerneltype;
+ ///< kerneltype used to generate the kernel corresponding to the data
+ ///< in Z
double *kernelparam;
+ ///< kernelparameters used to generate the kernel corresponding to the
+ ///< data in Z
};
/**
diff --git a/include/gensvm_globals.h b/include/gensvm_globals.h
index 7c3b68e..75b13d5 100644
--- a/include/gensvm_globals.h
+++ b/include/gensvm_globals.h
@@ -48,24 +48,45 @@
#include <time.h>
#include <cblas.h>
+/**
+ * Maximum line length of files that are read into GenSVM.
+ */
#define MAX_LINE_LENGTH 1024
#ifndef MIN_MAX_DEFINE
-#define MIN_MAX_DEFINE
-#define maximum(a, b) (a) > (b) ? (a) : (b)
-#define minimum(a, b) (a) < (b) ? (a) : (b)
+ /**
+ * Flag to check if minimum/maximum macro's are already defined. This can be
+ * useful when linking.
+ */
+ #define MIN_MAX_DEFINE
+ /**
+ * Macro for taking the maximum of two arguments.
+ */
+ #define maximum(a, b) (a) > (b) ? (a) : (b)
+ /**
+ * Macro for taking the minimum of two arguments.
+ */
+ #define minimum(a, b) (a) < (b) ? (a) : (b)
#endif
-// Set a matrix element (RowMajor)
+/**
+ * Macro for setting a matrix element (RowMajor order)
+ */
#define matrix_set(M, cols, i, j, val) M[(i)*(cols)+j] = val
-// Get a matrix element (RowMajor)
+/**
+ * Macro for getting a matrix element (RowMajor order)
+ */
#define matrix_get(M, cols, i, j) M[(i)*(cols)+j]
-// Add to a matrix element (RowMajor)
+/**
+ * Macro for adding to a matrix element (RowMajor order)
+ */
#define matrix_add(M, cols, i, j, val) M[(i)*(cols)+j] += val
-// Multiply a matrix element (RowMajor)
+/**
+ * Macro for multiplying a matrix element (RowMajor order)
+ */
#define matrix_mul(M, cols, i, j, val) M[(i)*(cols)+j] *= val
#endif
diff --git a/include/gensvm_grid.h b/include/gensvm_grid.h
index 24a6e9a..900a62a 100644
--- a/include/gensvm_grid.h
+++ b/include/gensvm_grid.h
@@ -66,28 +66,52 @@
*/
struct GenGrid {
TrainType traintype;
+ ///< type of training to use
KernelType kerneltype;
+ ///< type of kernel to use throughout training
long folds;
+ ///< number of folds in cross validation
long repeats;
+ ///< number of repeats to be done after the grid search to find the
+ ///< parameter set with the most consistent high performance
double percentile;
+ ///< percentile to use for the consistency repeats
long Np;
+ ///< size of the array of p values
long Nl;
+ ///< size of the array of lambda values
long Nk;
+ ///< size of the array of kappa values
long Ne;
+ ///< size of the array of epsilon values
long Nw;
+ ///< size of the array of weight_idx values
long Ng;
+ ///< size of the array of gamma values
long Nc;
+ ///< size of the array of coef values
long Nd;
+ ///< size of the array of degree values
int *weight_idxs;
+ ///< array of weight_idxs
double *ps;
+ ///< array of p values
double *lambdas;
+ ///< array of lambda values
double *kappas;
+ ///< array of kappa values
double *epsilons;
+ ///< array of epsilon values
double *gammas;
+ ///< array of gamma values
double *coefs;
+ ///< array of coef values
double *degrees;
+ ///< array of degree values
char *train_data_file;
+ ///< filename of train data file
char *test_data_file;
+ ///< filename of test data file
};
// function declarations
diff --git a/include/gensvm_memory.h b/include/gensvm_memory.h
index 085fcec..e5982f6 100644
--- a/include/gensvm_memory.h
+++ b/include/gensvm_memory.h
@@ -32,12 +32,32 @@
#include <stddef.h>
+/**
+ * Wrapper macro for mycalloc(). This macro uses the __FILE__ and __LINE__
+ * standard macros to fill in some of the arguments to mycalloc(). This macro
+ * should be used when writing code, not mycalloc().
+ */
#define Calloc(type, size) \
mycalloc(__FILE__, __LINE__, size, sizeof(type))
+
+/**
+ * Wrapper macro for mymalloc(). This macro uses the __FILE__ and __LINE__
+ * standard macros to fill in some of the arguments to mymalloc(). This macro
+ * should be used when writing code, not mymalloc().
+ */
#define Malloc(type, size) \
mymalloc(__FILE__, __LINE__, (size)*sizeof(type))
+/**
+ * Wrapper macro for myrealloc(). This macro uses the __FILE__ and __LINE__
+ * standard macros to fill in some of the arguments to myrealloc(). This macro
+ * should be used when writing code, not myrealloc().
+ */
#define Realloc(var, type, size) \
myrealloc(__FILE__, __LINE__, (size)*sizeof(type), var)
+/**
+ * Wrapper macro for memset(). Since memset is only used to zero a matrix,
+ * this macro is defined.
+ */
#define Memset(var, type, size) \
memset(var, 0, (size)*sizeof(type))
diff --git a/include/gensvm_predict.h b/include/gensvm_predict.h
index ec644bb..069e8d3 100644
--- a/include/gensvm_predict.h
+++ b/include/gensvm_predict.h
@@ -38,10 +38,6 @@
// function declarations
void gensvm_predict_labels(struct GenData *testdata,
struct GenModel *model, long *predy);
-void gensvm_predict_labels_dense(struct GenData *testdata,
- struct GenModel *model, long *predy);
-void gensvm_predict_labels_sparse(struct GenData *testdata,
- struct GenModel *model, long *predy);
double gensvm_prediction_perf(struct GenData *data, long *perdy);
#endif
diff --git a/include/gensvm_queue.h b/include/gensvm_queue.h
index f8faa87..c680ebf 100644
--- a/include/gensvm_queue.h
+++ b/include/gensvm_queue.h
@@ -40,14 +40,17 @@
* This struct is basically just an array of pointers to Task instances,
* with a length and an index of the current task.
*
- * @param **tasks array of pointers to Task structs
+ * @param tasks array of pointers to Task structs
* @param N size of task array
* @param i index used for keeping track of the queue
*/
struct GenQueue {
struct GenTask **tasks;
+ ///< array of pointers to Task structs
long N;
+ ///< size of task array
long i;
+ ///< index used for keeping track of the queue
};
// function declarations
diff --git a/include/gensvm_task.h b/include/gensvm_task.h
index 803a2ec..03fcbb5 100644
--- a/include/gensvm_task.h
+++ b/include/gensvm_task.h
@@ -45,29 +45,41 @@
* @param lambda parameter for the GenModel
* @param epsilon parameter for the GenModel
* @param kerneltype parameter for the GenModel
- * @param *kernelparam parameters for the GenModel
- * @param *train_data pointer to the training data
- * @param *test_data pointer to the test data (if any)
+ * @param kernelparam kernel parameters for the GenModel
+ * @param train_data pointer to the training data
+ * @param test_data pointer to the test data (if any)
* @param performance performance after cross validation
*/
struct GenTask {
KernelType kerneltype;
+ ///< kerneltype parameter for the GenModel
int weight_idx;
+ ///< weight_idx parameter for the GenModel
long folds;
+ ///< number of folds in cross validation
long ID;
+ ///< numeric id of the task in the queue
double p;
+ ///< p parameter for the GenModel
double kappa;
+ ///< kappa parameter for the GenModel
double lambda;
+ ///< lambda parameter for the GenModel
double epsilon;
+ ///< epsilon parameter for the GenModel
double *kernelparam;
+ ///< kernelparam parameters for the GenModel
struct GenData *train_data;
+ ///< pointer to the training data
struct GenData *test_data;
+ ///< pointer to the test data (if any)
double performance;
+ ///< performance after cross validation
};
struct GenTask *gensvm_init_task();
-struct GenTask *gensvm_copy_task();
-void gensvm_free_task(struct GenTask *task);
+struct GenTask *gensvm_copy_task(struct GenTask *t);
+void gensvm_free_task(struct GenTask *t);
void gensvm_task_to_model(struct GenTask *task, struct GenModel *model);
#endif