12 int max_times_err_grows;
27 vector<float> ls_lasso;;
35 max_iter = 500;
stop_at_err = (float)1e-4; max_times_err_grows = 20;
method =
"logistic_sgd";
batch_size = 512; rate = (float)0.01; rate_decay = (float)1.0; momentum = (float)0.95; last_is_bias = 0;
40 ADD_SERIALIZATION_FUNCS(
method, last_is_bias, max_iter,
stop_at_err, max_times_err_grows,
batch_size, rate, rate_decay,
l_ridge,
l_lasso, ls_lasso,
ls_ridge,
nthreads,
err_freq)
61 int init(
void *params);
66 int Learn(
float *x,
float *y,
int nsamples,
int nftrs);
67 int Learn(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs);
69 int Predict(
float *x,
float *&preds,
int nsamples,
int nftrs)
const;
70 int Predict(
float *x,
float *&preds,
int nsamples,
int nftrs,
int transposed_flag)
const;
72 int denormalize_model(
float *f_avg,
float *f_std,
float lavel_avg,
float label_std);
74 void print(FILE *fp,
const string& prefix,
int level = 0)
const;
83 int Learn_full(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs);
84 int Learn_gd(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs);
85 int Learn_sgd(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs);
86 int Learn_logistic_sgd(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs);
87 int Learn_logistic_sgd_threaded(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs);
89 void set_eigen_threads()
const;
90 void calc_feature_importance(vector<float> &features_importance_scores,
const string &general_params,
const MedFeatures *features);
MedAlgo - APIs to different algorithms: Linear Models, RF, GBM, KNN, and more.
#define ADD_SERIALIZATION_FUNCS(...)
Definition SerializableObject.h:122
#define MEDSERIALIZE_SUPPORT(Type)
Definition SerializableObject.h:108
A class for holding features data as a virtual matrix
Definition MedFeatures.h:47
int Predict(float *x, float *&preds, int nsamples, int nftrs) const
Predict should be implemented for each model.
Definition MedGDLM.cpp:207
int set_params(map< string, string > &mapper)
The parsed fields from init command.
Definition MedGDLM.cpp:88
void calc_feature_contribs(MedMat< float > &x, MedMat< float > &contribs)
Feature contributions explains the prediction on each sample (aka BUT_WHY)
Definition MedGDLM.cpp:76
Base Interface for predictor.
Definition MedAlgo.h:78
int features_count
The model features count used in Learn, to validate when caling predict.
Definition MedAlgo.h:96
MedPredictorTypes classifier_type
The Predicotr enum type.
Definition MedAlgo.h:80
vector< string > model_features
The model features used in Learn, to validate when caling predict.
Definition MedAlgo.h:93
Definition SerializableObject.h:32
float l_lasso
labmda for lasso
Definition MedGDLM.h:26
int err_freq
the frequency in which the stopping err on loss will be tested, reccomended > 10
Definition MedGDLM.h:30
float stop_at_err
stop criteria
Definition MedGDLM.h:11
int batch_size
for sgd
Definition MedGDLM.h:14
string method
gd or sgd
Definition MedGDLM.h:13
int nthreads
labmdas for lasso
Definition MedGDLM.h:29
float l_ridge
lambda for ridge
Definition MedGDLM.h:24
vector< float > ls_ridge
lambdas for ridge
Definition MedGDLM.h:25