Medial Code Documentation
Loading...
Searching...
No Matches
MedTQRF.h
1#pragma once
3
4//========================================================================================
5// TQRF Wrapper
6//========================================================================================
7class MedTQRF : public MedPredictor {
8public:
9 TQRF_Forest _tqrf;
10
12 ~MedTQRF() {};
13
14 void init_defaults() {};
15
16 // initialize using the init_from_string() method (inherited from SerializableObject)
17
18 virtual int init(map<string, string>& mapper) { return _tqrf.init(mapper); }
19 virtual int set_params(map<string, string>& mapper) { return _tqrf.init(mapper); }
20
21 int Learn(float *x, float *y, const float *w, int nsamples, int nftrs) {
22 HMTHROW_AND_ERR("MedTQRF does not support the Learn(float *x, float *y, float *w, int nsamples, int nftrs). Use Learn(MedFeatures &feats) API instead\n");
23 };
24 int Predict(float *x, float *&preds, int nsamples, int nftrs) const {
25 HMTHROW_AND_ERR("MedTQRF does not support the Predict(float *x, float *&preds, int nsamples, int nftrs). Use Predict(MedMat<float> &x, vector<float> &preds) API instead\n");
26 }
27
28 int Learn(const MedFeatures &feats) { return _tqrf.Train(feats); }
29 int Predict(MedMat<float> &x, vector<float> &preds) const { return _tqrf.Predict(x, preds); }
30
31 ADD_CLASS_NAME(MedTQRF)
33
34};
35
MedAlgo - APIs to different algorithms: Linear Models, RF, GBM, KNN, and more.
@ MODEL_TQRF
to_use:"tqrf" TQRF model - creates MedTQRF
Definition MedAlgo.h:62
#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
Definition MedMat.h:63
Base Interface for predictor.
Definition MedAlgo.h:78
MedPredictorTypes classifier_type
The Predicotr enum type.
Definition MedAlgo.h:80
Definition MedTQRF.h:7
int Predict(float *x, float *&preds, int nsamples, int nftrs) const
Predict should be implemented for each model.
Definition MedTQRF.h:24
int Learn(float *x, float *y, const float *w, int nsamples, int nftrs)
Learn should be implemented for each model.
Definition MedTQRF.h:21
virtual int init(map< string, string > &mapper)
Virtual to init object from parsed fields.
Definition MedTQRF.h:18
Definition TQRF.h:500
int Train(const MedFeatures &medf, const MedMat< float > &Y)
The basic train matrix for TQRF is MedFeatures (!!) the reason is that it contains everything in one ...
Definition TQRF.cpp:622
int init(map< string, string > &map)
Virtual to init object from parsed fields.
Definition TQRF.h:509
int Predict(MedMat< float > &x, vector< float > &preds) const
However - the basic predict for this model is MedMat !! , as here it is much simpler : we only need t...
Definition TQRF.cpp:882