Mercurial > forge
view extra/NaN/src/linear.h @ 12706:01c5f2e1ec48 octave-forge
fix integer types - avoid compiler warnings
author | schloegl |
---|---|
date | Tue, 05 Jan 2016 10:00:14 +0000 |
parents | 0605cb0434ff |
children |
line wrap: on
line source
/* $Id$ Copyright (c) 2007-2009 The LIBLINEAR Project. Copyright (c) 2010 Alois Schloegl <alois.schloegl@gmail.com> This function is part of the NaN-toolbox http://pub.ist.ac.at/~schloegl/matlab/NaN/ This code was extracted from liblinear-1.51 in Jan 2010 and modified for the use with Octave This program 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. This program 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 this program; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LIBLINEAR_H #define _LIBLINEAR_H #ifdef __cplusplus extern "C" { #endif struct feature_node { int index; double value; }; struct problem { int l, n; int *y; struct feature_node **x; double bias; /* < 0 if no bias term */ double *W; /* instance weight */ }; enum { L2R_LR, L2R_L2LOSS_SVC_DUAL, L2R_L2LOSS_SVC, L2R_L1LOSS_SVC_DUAL, MCSVM_CS, L1R_L2LOSS_SVC, L1R_LR }; /* solver_type */ struct parameter { int solver_type; /* these are for training only */ double eps; /* stopping criteria */ double C; int nr_weight; int *weight_label; double* weight; }; struct model { struct parameter param; unsigned nr_class; /* number of classes */ int nr_feature; double *w; int *label; /* label of each class */ double bias; }; struct model* train(const struct problem *prob, const struct parameter *param); void cross_validation(const struct problem *prob, const struct parameter *param, int nr_fold, int *target); int predict_values(const struct model *model_, const struct feature_node *x, double* dec_values); int predict(const struct model *model_, const struct feature_node *x); int predict_probability(const struct model *model_, const struct feature_node *x, double* prob_estimates); int save_model(const char *model_file_name, const struct model *model_); struct model *load_model(const char *model_file_name); int get_nr_feature(const struct model *model_); int get_nr_class(const struct model *model_); void get_labels(const struct model *model_, int* label); void destroy_model(struct model *model_); void destroy_param(struct parameter *param); const char *check_parameter(const struct parameter *param); extern void (*liblinear_print_string) (const char *); #ifdef __cplusplus } #endif #endif /* _LIBLINEAR_H */