Skip to content

Commit

Permalink
Added missed parameters map handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Mar 20, 2012
1 parent 4064deb commit eec65f5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/shogun/kernel/CustomKernel.cpp
Expand Up @@ -29,14 +29,14 @@ CCustomKernel::init()
MS_NOT_AVAILABLE);
SG_ADD((CSGObject**)&m_col_subset, "col_subset", "Subset of columns",
MS_NOT_AVAILABLE);
SG_ADD(&m_free_km, "free_km", "Wheather kernel matrix should be freed in "
SG_ADD(&m_free_km, "free_km", "Whether kernel matrix should be freed in "
"destructor", MS_NOT_AVAILABLE);
m_parameters->add(&kmatrix, "kmatrix", "Kernel matrix.");
m_parameters->add(&upper_diagonal, "upper_diagonal");

/* new parameter from param version 0 to 1 */
m_parameter_map->put(
new SGParamInfo("m_free_km", CT_SCALAR, ST_NONE, PT_BOOL, 1),
new SGParamInfo("free_km", CT_SCALAR, ST_NONE, PT_BOOL, 1),
new SGParamInfo()
);

Expand All @@ -51,6 +51,7 @@ CCustomKernel::init()
new SGParamInfo("col_subset", CT_SCALAR, ST_NONE, PT_SGOBJECT, 1),
new SGParamInfo()
);
m_parameter_map->finalize_map();
}

CCustomKernel::CCustomKernel()
Expand Down
11 changes: 11 additions & 0 deletions src/shogun/machine/KernelMachine.cpp
Expand Up @@ -12,6 +12,7 @@
#include <shogun/machine/KernelMachine.h>
#include <shogun/lib/Signal.h>
#include <shogun/base/Parameter.h>
#include <shogun/base/ParameterMap.h>

using namespace shogun;

Expand Down Expand Up @@ -652,4 +653,14 @@ void CKernelMachine::init()
SG_ADD(&m_alpha, "m_alpha", "Array of coefficients alpha.",
MS_NOT_AVAILABLE);
SG_ADD(&m_svs, "m_svs", "Number of ``support vectors''.", MS_NOT_AVAILABLE);

m_parameter_map->put(
new SGParamInfo("custom_kernel", CT_SCALAR, ST_NONE, PT_SGOBJECT, 0),
new SGParamInfo()
);
m_parameter_map->put(
new SGParamInfo("kernel_backup", CT_SCALAR, ST_NONE, PT_SGOBJECT, 0),
new SGParamInfo()
);
m_parameter_map->finalize_map();
}
24 changes: 17 additions & 7 deletions src/shogun/machine/Machine.cpp
Expand Up @@ -12,6 +12,7 @@
#include <shogun/machine/Machine.h>
#include <shogun/base/Parameter.h>
#include <shogun/mathematics/Math.h>
#include <shogun/base/ParameterMap.h>

using namespace shogun;

Expand All @@ -21,14 +22,23 @@ CMachine::CMachine() : CSGObject(), m_max_train_time(0), m_labels(NULL),
m_data_locked=false;
m_store_model_features=false;

m_parameters->add(&m_max_train_time, "max_train_time",
"Maximum training time.");
m_parameters->add((machine_int_t*) &m_solver_type, "solver_type");
m_parameters->add((CSGObject**) &m_labels, "labels");
m_parameters->add(&m_store_model_features, "store_model_features",
"Should feature data of model be stored after training?");
SG_ADD(&m_max_train_time, "max_train_time",
"Maximum training time.", MS_NOT_AVAILABLE);
SG_ADD((machine_int_t*) &m_solver_type, "solver_type",
"Type of solver.", MS_NOT_AVAILABLE);
SG_ADD((CSGObject**) &m_labels, "labels",
"Labels to be used.", MS_NOT_AVAILABLE);
SG_ADD(&m_store_model_features, "store_model_features",
"Should feature data of model be stored after training?", MS_NOT_AVAILABLE);
SG_ADD(&m_data_locked, "data_locked",
"Flag weather data is locked", MS_NOT_AVAILABLE);
"Indicates whether data is locked", MS_NOT_AVAILABLE);

m_parameter_map->put(
new SGParamInfo("data_locked", CT_SCALAR, ST_NONE, PT_BOOL, 1),
new SGParamInfo()
);

m_parameter_map->finalize_map();
}

CMachine::~CMachine()
Expand Down

0 comments on commit eec65f5

Please sign in to comment.