8#define MED_QRF_DEF_NTREES 100
9#define MED_QRF_DEF_MAXQ 200
10#define MED_QRF_DEF_MIN_NODE 50
11#define MED_QRF_DEF_LEARN_NTHREADS 8
12#define MED_QRF_DEF_PREDICT_NTHREADS 8
13#define MED_QRF_DEF_SPREAD 0.1
20 int learn_nthreads, predict_nthreads;
29 int get_only_this_categ;
50 ntry, get_only_this_categ,
max_depth,
take_all_samples, spread,
keep_all_values,
sparse_values, min_node, n_categ, collect_oob, get_count,
quantiles)
51 void post_deserialization() {
if (
samp_vec.size() == 0) sampsize = NULL;
else sampsize = &
samp_vec[0]; }
71 virtual int set_params(map<string, string>& mapper);
78 int Learn(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs);
79 int Predict(
float *x,
float *&preds,
int nsamples,
int nftrs)
const;
88 void print(FILE *fp,
const string& prefix,
int level = 0)
const;
89 void printTrees(
const vector<string> &modelSignalNames,
const string &outputPath)
const;
90 void calc_feature_importance(vector<float> &features_importance_scores,
const string &general_params,
const MedFeatures *features);
95 void prepare_predict_single();
96 void predict_single(
const vector<float> &x, vector<float> &preds)
const;
99 void set_sampsize(
float *y,
int nsamples);
100 int Predict(
float *x,
float *&preds,
int nsamples,
int nftrs,
int get_count)
const;
102 vector<pair<float, int>> _indexd_quantiles;
103 vector<float> _sorted_quantiles;
105 bool prepared_single;
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
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
virtual int set_params(map< string, string > &mapper)
The parsed fields from init command.
Definition MedQRF.cpp:130
QRF_Forest qf
Model.
Definition MedQRF.h:58
int Predict(float *x, float *&preds, int nsamples, int nftrs) const
Predict should be implemented for each model.
Definition MedQRF.cpp:348
int n_preds_per_sample() const
Number of predictions per sample. typically 1 - but some models return several per sample (for exampl...
Definition MedQRF.cpp:478
QRF_TreeType get_tree_type(string name)
Definition MedQRF.cpp:180
int Learn(float *x, float *y, const float *w, int nsamples, int nftrs)
Learn should be implemented for each model.
Definition MedQRF.cpp:264
MedQRFParams params
Parameters.
Definition MedQRF.h:61
Definition SerializableObject.h:32
bool sparse_values
For keeping all values as a value-index(int):count(char) vector.
Definition MedQRF.h:36
vector< int > samp_vec
to be used when sampsize is NULL and max_samp,samp_vector > 0
Definition MedQRF.h:26
float samp_factor
if > 0 & sampsize if NULL : the maximal factor of samples between the 2 largest categories
Definition MedQRF.h:25
int max_depth
maximial depth of tree branches - if 0 no limit
Definition MedQRF.h:30
bool take_all_samples
use all samples - no sampling in building tree
Definition MedQRF.h:31
int max_samp
M if > 0 & sampsize is NULL : the maximal sampsize we will take from each category.
Definition MedQRF.h:24
bool keep_all_values
For quantile regression.
Definition MedQRF.h:35
int ntry
if ntry <= 0: ntry = (int)(sqrt((double)nfeat) + 1.0);
Definition MedQRF.h:28
vector< float > quantiles
For quantile regression.
Definition MedQRF.h:46