-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.cpp
More file actions
41 lines (38 loc) · 1.39 KB
/
model.cpp
File metadata and controls
41 lines (38 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "model.h"
// This is the actual C++ implementation from your model.h
namespace Eloquent {
namespace ML {
namespace Port {
class DecisionTree {
public:
int predict(float *x) {
if (x[2] <= -324.0) {
return 1;
} else {
if (x[2] <= -23.5) {
return 0;
} else {
if (x[2] <= 1746.5) {
return 1;
} else {
if (x[2] <= 24812.0) {
return 0;
} else {
return 1;
}
}
}
}
}
protected:
};
}
}
}
// Instantiate the C++ class object
Eloquent::ML::Port::DecisionTree model_instance;
// C-style wrapper function using C linkage (declared in model.h)
// This is the function called from your main C file (casestudy_code.c)
extern "C" int predict(float input_features[]) {
return model_instance.predict(input_features);
}