78 if (data->
spZ != NULL)
81 if (data->
Z == data->
RAW) {
108 model->
lambda = pow(2, -8.0);
150 model->
V =
Calloc(
double, (m+1)*(K-1));
152 model->
U =
Calloc(
double, K*(K-1));
153 model->
UU =
Calloc(
double, K*K*(K-1));
154 model->
Q =
Calloc(
double, n*K);
155 model->
H =
Calloc(
double, n*K);
176 if (model->
n == n && model->
m == m)
179 model->
Q =
Realloc(model->
Q,
double, n*K);
182 model->
H =
Realloc(model->
H,
double, n*K);
191 model->
V =
Realloc(model->
V,
double, (m+1)*(K-1));
192 Memset(model->
V,
double, (m+1)*(K-1));
257 work->
ZB =
Calloc(
double, (m+1)*(K-1)),
309 Memset(work->
ZB,
double, (m+1)*(K-1)),
#define Calloc(type, size)
long K
number of classes for the workspace
double * H
Huber weighted error matrix.
double * LZ
n x (m+1) working matrix for the Z'*A*Z calculation
double gamma
kernel parameter for RBF, poly, and sigmoid
void gensvm_free_model(struct GenModel *model)
Free allocated GenModel struct.
double epsilon
stopping criterion for the IM algorithm.
void gensvm_reallocate_model(struct GenModel *model, long n, long m)
Reallocate memory for GenModel.
double training_error
loss function value after training has finished
long m
number of features for the workspace
struct GenData * gensvm_init_data(void)
Initialize a GenData structure.
double p
parameter for the L-p norm in the loss function
double * UU
simplex difference matrix
struct GenModel * gensvm_init_model(void)
Initialize a GenModel structure.
#define Memset(var, type, size)
double * ZV
n x (K-1) working matrix for the Z * V calculation
void gensvm_free_sparse(struct GenSparse *sp)
Free an allocated GenSparse structure.
double degree
kernel parameter for poly
A structure to hold the GenSVM workspace.
struct GenWork * gensvm_init_work(struct GenModel *model)
Initialize the workspace structure.
int status
status of the model after training
double * ZBc
(K-1) x (m+1) working matrix for the Z'*B calculation
int weight_idx
which weights to use (1 = unit, 2 = group)
#define Malloc(type, size)
double * V
augmented weight matrix
double * ZAZ
(m+1) x (m+1) working matrix for the Z'*A*Z calculation
long * y
array of class labels, 1..K
void gensvm_reset_work(struct GenWork *work)
Reset all matrices of a GenWork instance.
A structure to represent the data.
A structure to represent a single GenSVM model.
double * ZB
(m+1) x (K-1) working matrix for the Z'*B calculation
void gensvm_free_work(struct GenWork *work)
Free an allocated GenWork instance.
void gensvm_free_data(struct GenData *data)
Free allocated GenData struct.
#define Realloc(var, type, size)
double * tmpZAZ
(m+1) x (m+1) temporary working matrix for the Z'*A*Z calculation
double * Sigma
eigenvalues from the reduced eigendecomposition
char * data_file
filename of the data
void gensvm_allocate_model(struct GenModel *model)
Allocate memory for a GenModel.
long n
number of instances in the dataset
long max_iter
maximum number of iterations of the algorithm
double * rho
vector of instance weights
long elapsed_iter
number of elapsed iterations in training
double kappa
parameter for the Huber hinge function
long K
number of classes in the dataset
double degree
kernel parameter for poly
double coef
kernel parameter for poly and sigmoid
KernelType kerneltype
type of kernel used in the model
double gamma
kernel parameter for RBF, poly, and sigmoid
double coef
kernel parameter for poly and sigmoid
Header file for gensvm_base.c.
long n
number of instances for the workspace
long m
number of predictor variables in the dataset
double * RAW
augmented raw data matrix
double kernel_eigen_cutoff
cutoff value for the ratio of eigenvalues in the reduced
struct GenSparse * spZ
sparse representation of the augmented data matrix
double * beta
K-1 working vector for a row of the B matrix.
double lambda
regularization parameter in the loss function