GenSVM
|
Functions for initializing model and data structures. More...
Go to the source code of this file.
Functions | |
void | gensvm_init_V (struct GenModel *from_model, struct GenModel *to_model, struct GenData *data) |
Seed the matrix V from an existing model or using rand. More... | |
void | gensvm_initialize_weights (struct GenData *data, struct GenModel *model) |
Initialize instance weights. More... | |
Functions for initializing model and data structures.
This file contains functions for initializing a GenModel instance and a GenData instance. In addition, default values for these structures are defined here (and only here). Functions for allocating memory for the model structure and freeing of the model and data structures are also included.
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_init.c.
void gensvm_init_V | ( | struct GenModel * | from_model, |
struct GenModel * | to_model, | ||
struct GenData * | data | ||
) |
Seed the matrix V from an existing model or using rand.
The matrix V must be seeded before the main_loop() can start. This can be done by either seeding it with random numbers or using the solution from a previous model on the same dataset as initial seed. The latter option usually allows for a significant improvement in the number of iterations necessary because the seeded model V is closer to the optimal V.
When no seed model is supplied, the rows of V are seeded with random numbers between the inverse of the minimum and the inverse of the maximum of the corresponding column of Z. This is done to center the product of the two in the simplex space.
[in] | from_model | GenModel from which to copy V |
[in,out] | to_model | GenModel to which V will be copied |
[in] | data | GenData structure with the data |
Definition at line 57 of file gensvm_init.c.
Initialize instance weights.
Instance weights can for instance be used to add additional weights to instances of certain classes. Two default weight possibilities are implemented here. The first is unit weights, where each instance gets weight 1.
The second are group size correction weights, which are calculated as
where is the number of instances in group
and
.
[in] | data | GenData with the dataset |
[in,out] | model | GenModel with the weight specification. On exit GenModel::rho contains the instance weights. |
Definition at line 152 of file gensvm_init.c.