Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register parameters in tags (#4117) #4123

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/shogun/classifier/PluginEstimate.cpp
Expand Up @@ -22,16 +22,33 @@ CPluginEstimate::CPluginEstimate(float64_t pos_pseudo, float64_t neg_pseudo)
{
m_parameters->add(&m_pos_pseudo,
"pos_pseudo","pseudo count for positive class");
watch_param(
"pos_pseudo", &m_pos_pseudo,
AnyParameterProperties("pseudo count for positive class"));

m_parameters->add(&m_neg_pseudo,
"neg_pseudo", "pseudo count for negative class");
watch_param(
"neg_pseudo", &m_neg_pseudo,
AnyParameterProperties("pseudo count for negative class"));

m_parameters->add((CSGObject**) &pos_model,
"pos_model", "LinearHMM modelling positive class.");
watch_param(
"pos_model", (CSGObject**)&pos_model,
AnyParameterProperties("LinearHMM modelling positive class."));

m_parameters->add((CSGObject**) &neg_model,
"neg_model", "LinearHMM modelling negative class.");
watch_param(
"neg_model", (CSGObject**)&neg_model,
AnyParameterProperties("LinearHMM modelling negative class."));

m_parameters->add((CSGObject**) &features,
"features", "String Features.");
watch_param(
"features", (CSGObject**)&features,
AnyParameterProperties("LinearHMM modelling negative class."));
}

CPluginEstimate::~CPluginEstimate()
Expand Down
7 changes: 7 additions & 0 deletions src/shogun/classifier/svm/OnlineLibLinear.cpp
Expand Up @@ -64,8 +64,15 @@ void COnlineLibLinear::init()
use_bias=false;

m_parameters->add(&C1, "C1", "C Cost constant 1.");
watch_param("C1", &C1, AnyParameterProperties("C Cost constant 1."));

m_parameters->add(&C2, "C2", "C Cost constant 2.");
watch_param("C2", &C2, AnyParameterProperties("C Cost constant 2."));

m_parameters->add(&use_bias, "use_bias", "Indicates if bias is used.");
watch_param(
"use_bias", &use_bias,
AnyParameterProperties("Indicates if bias is used."));

PG = 0;
PGmax_old = CMath::INFTY;
Expand Down
24 changes: 24 additions & 0 deletions src/shogun/classifier/svm/OnlineSVMSGD.cpp
Expand Up @@ -205,13 +205,37 @@ void COnlineSVMSGD::init()
SG_REF(loss);

m_parameters->add(&C1, "C1", "Cost constant 1.");
watch_param("C1", &C1, AnyParameterProperties("Cost constant 1."));

m_parameters->add(&C2, "C2", "Cost constant 2.");
watch_param("C2", &C2, AnyParameterProperties("Cost constant 2."));

m_parameters->add(&lambda, "lambda", "Regularization parameter.");
watch_param(
"lambda", &lambda, AnyParameterProperties("Regularization parameter."));

m_parameters->add(&wscale, "wscale", "W scale");
watch_param("wscale", &wscale, AnyParameterProperties("W scale"));

m_parameters->add(&bscale, "bscale", "b scale");
watch_param("bscale", &bscale, AnyParameterProperties("b scale"));

m_parameters->add(&epochs, "epochs", "epochs");
watch_param("epochs", &epochs, AnyParameterProperties("epochs"));

m_parameters->add(&skip, "skip", "skip");
watch_param("skip", &skip, AnyParameterProperties("skip"));

m_parameters->add(&count, "count", "count");
watch_param("count", &count, AnyParameterProperties("count"));

m_parameters->add(&use_bias, "use_bias", "Indicates if bias is used.");
watch_param(
"use_bias", &use_bias,
AnyParameterProperties("Indicates if bias is used."));

m_parameters->add(&use_regularized_bias, "use_regularized_bias", "Indicates if bias is regularized.");
watch_param(
"use_regularized_bias", &use_regularized_bias,
AnyParameterProperties("Indicates if bias is regularized."));
}
9 changes: 9 additions & 0 deletions src/shogun/classifier/svm/SGDQN.cpp
Expand Up @@ -225,8 +225,17 @@ void CSGDQN::init()
SG_REF(loss);

m_parameters->add(&C1, "C1", "Cost constant 1.");
watch_param("C1", &C1, AnyParameterProperties("Cost constant 1."));

m_parameters->add(&C2, "C2", "Cost constant 2.");
watch_param("C2", &C2, AnyParameterProperties("Cost constant 2."));

m_parameters->add(&epochs, "epochs", "epochs");
watch_param("epochs", &epochs, AnyParameterProperties("epochs"));

m_parameters->add(&skip, "skip", "skip");
watch_param("skip", &skip, AnyParameterProperties("skip"));

m_parameters->add(&count, "count", "count");
watch_param("count", &count, AnyParameterProperties("count"));
}
41 changes: 32 additions & 9 deletions src/shogun/classifier/svm/SVMSGD.cpp
Expand Up @@ -214,13 +214,36 @@ void CSVMSGD::init()
loss=new CHingeLoss();
SG_REF(loss);

m_parameters->add(&C1, "C1", "Cost constant 1.");
m_parameters->add(&C2, "C2", "Cost constant 2.");
m_parameters->add(&wscale, "wscale", "W scale");
m_parameters->add(&bscale, "bscale", "b scale");
m_parameters->add(&epochs, "epochs", "epochs");
m_parameters->add(&skip, "skip", "skip");
m_parameters->add(&count, "count", "count");
m_parameters->add(&use_bias, "use_bias", "Indicates if bias is used.");
m_parameters->add(&use_regularized_bias, "use_regularized_bias", "Indicates if bias is regularized.");
m_parameters->add(&C1, "C1", "Cost constant 1.");
watch_param("C1", &C1, AnyParameterProperties("Cost constant 1."));

m_parameters->add(&C2, "C2", "Cost constant 2.");
watch_param("C2", &C2, AnyParameterProperties("Cost constant 2."));

m_parameters->add(&wscale, "wscale", "W scale");
watch_param("wscale", &wscale, AnyParameterProperties("W scale"));

m_parameters->add(&bscale, "bscale", "b scale");
watch_param("bscale", &bscale, AnyParameterProperties("b scale"));

m_parameters->add(&epochs, "epochs", "epochs");
watch_param("epochs", &epochs, AnyParameterProperties("epochs"));

m_parameters->add(&skip, "skip", "skip");
watch_param("skip", &skip, AnyParameterProperties("skip"));

m_parameters->add(&count, "count", "count");
watch_param("count", &count, AnyParameterProperties("count"));

m_parameters->add(&use_bias, "use_bias", "Indicates if bias is used.");
watch_param(
"use_bias", &use_bias,
AnyParameterProperties("Indicates if bias is used."));

m_parameters->add(
&use_regularized_bias, "use_regularized_bias",
"Indicates if bias is regularized.");
watch_param(
"use_regularized_bias", &use_regularized_bias,
AnyParameterProperties("Indicates if bias is regularized."));
}
3 changes: 3 additions & 0 deletions src/shogun/clustering/GMM.cpp
Expand Up @@ -823,5 +823,8 @@ void CGMM::register_params()
//TODO serialization broken
//m_parameters->add((SGVector<CSGObject*>*) &m_components, "m_components", "Mixture components");
m_parameters->add(&m_coefficients, "m_coefficients", "Mixture coefficients.");
watch_param(
"m_coefficients", &m_coefficients,
AnyParameterProperties("Mixture coefficients."));
}

4 changes: 4 additions & 0 deletions src/shogun/converter/HashedDocConverter.cpp
Expand Up @@ -65,8 +65,12 @@ void CHashedDocConverter::init(CTokenizer* tzer, int32_t hash_bits, bool normali
MS_NOT_AVAILABLE);
SG_ADD(&should_normalize, "should_normalize", "Whether to normalize vectors or not",
MS_NOT_AVAILABLE);

m_parameters->add((CSGObject**) &tokenizer, "tokenizer",
"Tokenizer");
watch_param(
"tokenizer", (CSGObject**)&tokenizer,
AnyParameterProperties("Tokenizer"));
}

const char* CHashedDocConverter::get_name() const
Expand Down
3 changes: 3 additions & 0 deletions src/shogun/distance/AttenuatedEuclideanDistance.cpp
Expand Up @@ -67,4 +67,7 @@ void CAttenuatedEuclideanDistance::init()
disable_sqrt=false;

m_parameters->add(&disable_sqrt, "disable_sqrt", "If sqrt shall not be applied.");
watch_param(
"disable_sqrt", &disable_sqrt,
AnyParameterProperties("If sqrt shall not be applied."));
}
3 changes: 3 additions & 0 deletions src/shogun/distance/CustomDistance.cpp
Expand Up @@ -126,6 +126,9 @@ void CCustomDistance::init()
watch_param("dmatrix", &dmatrix, &num_rows, &num_cols);

m_parameters->add(&upper_diagonal, "upper_diagonal", "Upper diagonal");
watch_param(
"upper_diagonal", &upper_diagonal,
AnyParameterProperties("Upper diagonal"));
}

void CCustomDistance::cleanup()
Expand Down
7 changes: 7 additions & 0 deletions src/shogun/distance/Distance.cpp
Expand Up @@ -261,8 +261,15 @@ void CDistance::init()

m_parameters->add((CSGObject**) &lhs, "lhs",
"Feature vectors to occur on left hand side.");
watch_param(
"lhs", (CSGObject**)&lhs,
AnyParameterProperties("Feature vectors to occur on left hand side."));

m_parameters->add((CSGObject**) &rhs, "rhs",
"Feature vectors to occur on right hand side.");
watch_param(
"rhs", (CSGObject**)&rhs,
AnyParameterProperties("Feature vectors to occur on right hand side."));
}

template <class T>
Expand Down
3 changes: 3 additions & 0 deletions src/shogun/distance/HammingWordDistance.cpp
Expand Up @@ -171,4 +171,7 @@ void CHammingWordDistance::init()
use_sign = false;
m_parameters->add(&use_sign, "use_sign",
"If signum(counts) is used instead of counts.");
watch_param(
"use_sign", &use_sign,
AnyParameterProperties("If signum(counts) is used instead of counts."));
}
4 changes: 4 additions & 0 deletions src/shogun/distance/KernelDistance.cpp
Expand Up @@ -70,6 +70,10 @@ void CKernelDistance::init()
width = 0.0;

m_parameters->add(&width, "width", "Width of RBF Kernel");
watch_param("width", &width, AnyParameterProperties("Width of RBF Kernel"));

m_parameters->add((CSGObject**) &kernel, "kernel",
"Kernel.");
watch_param(
"kernel", (CSGObject**)&kernel, AnyParameterProperties("kernel."));
}
9 changes: 9 additions & 0 deletions src/shogun/distance/MahalanobisDistance.cpp
Expand Up @@ -107,7 +107,16 @@ void CMahalanobisDistance::init()
use_mean=false;

m_parameters->add(&disable_sqrt, "disable_sqrt", "If sqrt shall not be applied.");
watch_param(
"disable_sqrt", &disable_sqrt,
AnyParameterProperties("If sqrt shall not be applied."));

m_parameters->add(&use_mean, "use_mean", "If distance shall be computed between mean vector and vector from rhs or between lhs and rhs.");
watch_param(
"use_mean", &use_mean,
AnyParameterProperties(
"If distance shall be computed between mean vector and vector from "
"rhs or between lhs and rhs."));
}

#endif /* HAVE_LAPACK */
11 changes: 11 additions & 0 deletions src/shogun/distributions/PositionalPWM.cpp
Expand Up @@ -125,10 +125,21 @@ void CPositionalPWM::compute_w(int32_t num_pos)
void CPositionalPWM::register_params()
{
m_parameters->add(&m_poim, "poim", "POIM Scoring Matrix");
watch_param("poim", &m_poim, AnyParameterProperties("POIM Scoring Matrix"));

m_parameters->add(&m_w, "w", "Scoring Matrix");
watch_param("w", &m_w, AnyParameterProperties("Scoring Matrix"));

m_parameters->add(&m_pwm, "pwm", "Positional Weight Matrix.");
watch_param(
"pwm", &m_pwm, AnyParameterProperties("Positional Weight Matrix."));

m_parameters->add(&m_sigma, "sigma", "Standard Deviation.");
watch_param(
"sigma", &m_sigma, AnyParameterProperties("Standard Deviation."));

m_parameters->add(&m_mean, "mean", "Mean.");
watch_param("mean", &m_mean, AnyParameterProperties("Mean."));
}

void CPositionalPWM::compute_scoring(int32_t max_degree)
Expand Down
15 changes: 15 additions & 0 deletions src/shogun/evaluation/SplittingStrategy.cpp
Expand Up @@ -57,10 +57,25 @@ void CSplittingStrategy::init()
m_num_subsets=0;

m_parameters->add((CSGObject**)&m_labels, "labels", "Labels for subsets");
watch_param(
"labels", (CSGObject**)&m_labels,
AnyParameterProperties("Labels for subsets"));

m_parameters->add((CSGObject**)&m_subset_indices, "subset_indices",
"Set of sets of subset indices");
watch_param(
"subset_indices", (CSGObject**)&m_subset_indices,
AnyParameterProperties("Set of sets of subset indices"));

m_parameters->add(&m_is_filled, "is_filled", "Whether ther are index sets");
watch_param(
"is_filled", &m_is_filled,
AnyParameterProperties("Whether ther are index sets"));

m_parameters->add(&m_num_subsets, "num_subsets", "Number of index sets");
watch_param(
"num_subsets", &m_num_subsets,
AnyParameterProperties("Number of index sets"));
}

CSplittingStrategy::~CSplittingStrategy()
Expand Down
10 changes: 10 additions & 0 deletions src/shogun/features/Alphabet.cpp
Expand Up @@ -729,10 +729,20 @@ void CAlphabet::init()

m_parameters->add((machine_int_t*) &alphabet, "alphabet",
"Alphabet enum.");
watch_param(
"alphabet", (machine_int_t*)&alphabet,
AnyParameterProperties("Alphabet enum."));

m_parameters->add(&num_symbols, "num_symbols",
"Number of symbols.");
watch_param(
"num_symbols", &num_symbols,
AnyParameterProperties("Number of symbols."));

m_parameters->add(&num_bits, "num_bits",
"Number of bits.");
watch_param(
"num_bits", &num_symbols, AnyParameterProperties("Number of bits."));

/* We don't need to serialize the mapping tables / they can be computed
* after de-serializing. Lets not serialize the histogram for now. Doesn't
Expand Down
12 changes: 11 additions & 1 deletion src/shogun/features/CombinedDotFeatures.cpp
Expand Up @@ -343,9 +343,19 @@ void CCombinedDotFeatures::init()
{
m_parameters->add(&num_dimensions, "num_dimensions",
"Total number of dimensions.");
watch_param(
"num_dimensions", &num_dimensions,
AnyParameterProperties("Total number of dimensions."));

m_parameters->add(&num_vectors, "num_vectors",
"Total number of vectors.");
watch_param(
"num_vectors", &num_vectors,
AnyParameterProperties("Total number of vectors."));

m_parameters->add((CSGObject**) &feature_array,
"feature_array", "Feature array.");
watch_param(
"feature_array", (CSGObject**)&feature_array,
AnyParameterProperties("Feature array."));
}

6 changes: 6 additions & 0 deletions src/shogun/features/CombinedFeatures.cpp
Expand Up @@ -168,8 +168,14 @@ void CCombinedFeatures::init()
{
m_parameters->add(&num_vec, "num_vec",
"Number of vectors.");
watch_param(
"num_vec", &num_vec, AnyParameterProperties("Number of vectors."));

m_parameters->add((CSGObject**) &feature_array,
"feature_array", "Feature array.");
watch_param(
"feature_array", (CSGObject**)&feature_array,
AnyParameterProperties("Feature array."));
}

CFeatures* CCombinedFeatures::create_merged_copy(CFeatures* other)
Expand Down
3 changes: 3 additions & 0 deletions src/shogun/features/DotFeatures.cpp
Expand Up @@ -408,4 +408,7 @@ void CDotFeatures::init()
set_property(FP_DOT);
m_parameters->add(&combined_weight, "combined_weight",
"Feature weighting in combined dot features.");
watch_param(
"combined_weight", &combined_weight,
AnyParameterProperties("Feature weighting in combined dot features."));
}
3 changes: 3 additions & 0 deletions src/shogun/features/DummyFeatures.cpp
Expand Up @@ -48,4 +48,7 @@ void CDummyFeatures::init()
{
m_parameters->add(&num_vectors, "num_vectors",
"Number of feature vectors.");
watch_param(
"num_vectors", &num_vectors,
AnyParameterProperties("Number of feature vectors."));
}
1 change: 1 addition & 0 deletions src/shogun/features/FKFeatures.cpp
Expand Up @@ -256,4 +256,5 @@ void CFKFeatures::init()
//m_parameters->add((CSGObject**) &pos, "pos", "HMM for positive class.");
//m_parameters->add((CSGObject**) &neg, "neg", "HMM for negative class.");
m_parameters->add(&weight_a, "weight_a", "Class prior.");
watch_param("weight_a", &weight_a, AnyParameterProperties("Class prior."));
}