fixed user module (dt)
This commit is contained in:
+2
-1
@@ -1,4 +1,5 @@
|
||||
example:
|
||||
$(CXX) -shared -fPIC example.cpp aquery_mem.cpp -fno-semantic-interposition -Ofast -march=native -flto --std=c++1z -o ../test.so
|
||||
|
||||
irf:
|
||||
$(CXX) -shared -fPIC RF.cpp irf.cpp incrementalDecisionTree.cpp aquery_mem.cpp Evaluation.cpp -fno-semantic-interposition -Ofast -march=native -flto --std=c++1z -o ../libirf.so
|
||||
all: example
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
#include <fstream>
|
||||
#include <float.h>
|
||||
#include <ctime>
|
||||
#include <random>
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
struct minEval{
|
||||
double value;
|
||||
int* values;
|
||||
@@ -54,7 +57,7 @@ long* Rands(long feature, long maxFeature){
|
||||
if(maxFeature==feature){
|
||||
return ret;
|
||||
}
|
||||
std::random_shuffle(ret, &ret[feature]);
|
||||
std::shuffle(ret, &ret[feature], g);
|
||||
long* ret2 = (long*) malloc(maxFeature*sizeof(long));
|
||||
for(i=0; i<maxFeature; i++)ret2[i] = ret[i];
|
||||
free(ret);
|
||||
@@ -473,7 +476,7 @@ void DecisionTree::IncrementalUpdate(double** data, long* result, long size, DT*
|
||||
for(i=0; i<current->size; i++){
|
||||
index[i] = i;
|
||||
}
|
||||
std::random_shuffle(index, index+current->size);
|
||||
std::shuffle(index, index+current->size, g);
|
||||
long x = 0;
|
||||
for(i=0;i<current->size;i++){
|
||||
if(i>=current->size-forgetSize){
|
||||
|
||||
+3
-2
@@ -33,6 +33,7 @@ __AQEXPORT__(bool) additem(ColRef<double>X, long y, long size){
|
||||
data[pt][j]=X.container[j];
|
||||
}
|
||||
result[pt] = y;
|
||||
pt ++;
|
||||
return 1;
|
||||
}
|
||||
__AQEXPORT__(bool) fit(){
|
||||
@@ -46,8 +47,8 @@ __AQEXPORT__(ColRef_storage) predict(){
|
||||
for(long i=0; i<pt; i++){
|
||||
result[i]=dt->Test(data[i], dt->DTree);
|
||||
}
|
||||
ColRef_storage ret(result, pt, pt, "prediction", 0);
|
||||
return ret;
|
||||
|
||||
return ColRef_storage(new ColRef_storage(result, pt, 0, "prediction", 0), 1, 0, "prediction", 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user