Medial Code Documentation
Loading...
Searching...
No Matches
MedMultiClass.h
1#pragma once
3
4//================================================================
5// MultiClass
6//================================================================
7enum MedMultiClassType {
8 MULTI_CLASS_ONE_VS_ALL = 1,
9 MULTI_CLASS_LAST
10};
11
13
14 MedPredictorTypes method;
15 MedMultiClassType multi_class_type;
16
17 vector<float> class_values;
18 void *internal_params;
19
20};
21
22
23struct MedMultiClass : public MedPredictor {
24
26 vector<MedPredictor *> internal_predictors;
27
28 // Function
30 MedMultiClass(void *params);
32
33 int init(void *params);
34 void set_internal_method(MedPredictorTypes type);
35 void init_defaults();
37
38 int init_classifiers();
39 int init_classifier(int index);
40
41 int Learn(float *x, float *y, int nsamples, int nftrs);
42 int Learn(float *x, float *y, const float *w, int nsamples, int nftrs);
43
44 int Predict(float *x, float *&preds, int nsamples, int nftrs) const;
45
46 // Print
47 void print(FILE *fp, const string& prefix, int level = 0) const;
48
49 // Predictions per sample
50 int n_preds_per_sample() const;
51
52 // (De)Desrialize - virtual class methods that do the actuale (De)Serializing. Should be created for each predictor
53 ADD_CLASS_NAME(MedMultiClass)
54 ADD_SERIALIZATION_FUNCS(classifier_type, params.method, params.multi_class_type, internal_predictors)
55};
56
MedAlgo - APIs to different algorithms: Linear Models, RF, GBM, KNN, and more.
MedPredictorTypes
Definition MedAlgo.h:44
#define ADD_SERIALIZATION_FUNCS(...)
Definition SerializableObject.h:122
#define MEDSERIALIZE_SUPPORT(Type)
Definition SerializableObject.h:108
Base Interface for predictor.
Definition MedAlgo.h:78
MedPredictorTypes classifier_type
The Predicotr enum type.
Definition MedAlgo.h:80
Definition MedMultiClass.h:12
Definition MedMultiClass.h:23
int n_preds_per_sample() const
Number of predictions per sample. typically 1 - but some models return several per sample (for exampl...
Definition MedMultiClass.cpp:171
int Predict(float *x, float *&preds, int nsamples, int nftrs) const
Predict should be implemented for each model.
Definition MedMultiClass.cpp:180