This function gives the coefficient for the feature with feature index =
feat_idx and the class with label index = label_idx. Note that feat_idx
- starts from 1, while label_idx starts from 0. If label_idx is not in the
- valid range (0 to nr_class-1), then a NaN will be returned; and if feat_idx
- is not in the valid range (1 to nr_feature), then a zero value will be
- returned. For regression models, label_idx is ignored.
+ starts from 1, while label_idx starts from 0. If feat_idx is not in the
+ valid range (1 to nr_feature), then a zero value will be returned. For
+ classification models, if label_idx is not in the valid range (0 to
+ nr_class-1), then a zero value will be returned; for regression models,
+ label_idx is ignored.
- Function: double get_decfun_bias(const struct model *model_, int label_idx);
- This function gives the bias term corresponding to the class with the
- label_idx. For regression models, label_idx is ignored.
+ This function gives the bias term corresponding to the class with the
+ label_idx. For classification models, if label_idx is not in a valid range
+ (0 to nr_class-1), then a zero value will be returned; for regression
+ models, label_idx is ignored.
- Function: const char *check_parameter(const struct problem *prob,
const struct parameter *param);
int solver_type = model_->param.solver_type;
const double *w = model_->w;
- if(!check_regression_model(model_) && (label_idx < 0 || label_idx >= nr_class))
- {
- const double nan = 0.0/0.0;
- return nan;
- }
if(idx < 0 || idx > model_->nr_feature)
return 0;
if(check_regression_model(model_))
return w[idx];
else
{
+ if(label_idx < 0 || label_idx >= nr_class)
+ return 0;
if(nr_class == 2 && solver_type != MCSVM_CS)
{
if(label_idx == 0)