15 vector<micNet> model_per_thread;
16 bool is_prepared =
false;
32 cerr <<
"MedMicNet init_from_string ! :: " << initialization_text <<
"\n";
34 cerr <<
"calling init_from_string of micNet\n"; fflush(stderr);
35 return mic.init_from_string(initialization_text);
39 int init(map<string, string>& mapper) {
40 cerr <<
"MedMicNet:: init map :: not supported, only init_from_string supported....\n";
43 int set_params(map<string, string>& mapper) {
44 cerr <<
"MedMicNet:: init map :: not supported, only init_from_string supported....\n";
48 void init_defaults() {
mic_params.init_string =
""; mic.params.init_defaults(); }
50 int Learn(
float *x,
float *y,
const float *w,
int nsamples,
int nftrs) {
51 cerr <<
"MedMicNet:: Learn :: API's with MedMat are preferred....\n";
55 if (w != NULL) wmat.load(w, nsamples, 1);
56 return learn(xmat, ymat, wmat.get_vec());
59 int Predict(
float *x,
float *&preds,
int nsamples,
int nftrs)
const {
60 cerr <<
"MedMicNet:: Predict :: API's with MedMat are preferred....\n";
63 int rc = predict(xmat, vpreds);
64 if (preds == NULL) preds =
new float[nsamples];
65 memcpy(preds, &vpreds[0],
sizeof(
float)*nsamples);
71 int predict(
MedMat<float> &x, vector<float> &preds)
const {
micNet mutable_net = mic;
return mutable_net.predict(x, preds); }
73 void prepare_predict_single();
74 void predict_single(
const vector<float> &x, vector<float> &preds)
const;
MedAlgo - APIs to different algorithms: Linear Models, RF, GBM, KNN, and more.
@ MODEL_MIC_NET
to_use:"micNet" Home brew Neural Net implementation (Allows deep learning) - creates MedMicNet
Definition MedAlgo.h:54
#define ADD_SERIALIZATION_FUNCS(...)
Definition SerializableObject.h:122
#define MEDSERIALIZE_SUPPORT(Type)
Definition SerializableObject.h:108
Definition MedMicNet.h:13
int init_from_string(string initialization_text)
The parsed fields from init command.
Definition MedMicNet.h:31
int Learn(float *x, float *y, const float *w, int nsamples, int nftrs)
Learn should be implemented for each model.
Definition MedMicNet.h:50
MedMicNetParams mic_params
Parameters.
Definition MedMicNet.h:22
int Predict(float *x, float *&preds, int nsamples, int nftrs) const
Predict should be implemented for each model.
Definition MedMicNet.h:59
int n_preds_per_sample() const
Number of predictions per sample. typically 1 - but some models return several per sample (for exampl...
Definition MedMicNet.h:77
int init(map< string, string > &mapper)
MedMicNet:: init map :: not supported, only init_from_string supported.
Definition MedMicNet.h:39
Base Interface for predictor.
Definition MedAlgo.h:78
MedPredictorTypes classifier_type
The Predicotr enum type.
Definition MedAlgo.h:80