diff --git a/sdk/Evaluation.cpp b/sdk/Evaluation.cpp index 3683597..8e347a7 100644 --- a/sdk/Evaluation.cpp +++ b/sdk/Evaluation.cpp @@ -5,14 +5,13 @@ struct minEval{ double value; - double values; + int* values; double eval; long left; // how many on its left double* record; long max; long** count; - long* sorted; // sorted d }; minEval giniSparse(double** data, long* result, long* d, long size, long col, long classes, long* totalT){ diff --git a/sdk/irf.cpp b/sdk/irf.cpp index 36cf4c2..0f9aac1 100644 --- a/sdk/irf.cpp +++ b/sdk/irf.cpp @@ -4,9 +4,6 @@ #include "../server/table.h" DecisionTree* dt = nullptr; -long pt = 0; -double** data = nullptr; -long* result = nullptr; __AQEXPORT__(bool) newtree(int height, long f, ColRef sparse, double forget, long maxf, long noclasses, Evaluation e, long r, long rb){ if(sparse.size!=f)return 0; @@ -19,14 +16,13 @@ __AQEXPORT__(bool) newtree(int height, long f, ColRef sparse, double forget return 1; } -__AQEXPORT__(bool) additem(ColRefX, long y, long size){ - long j = 0; - if(size>0){ - free(data); - free(result); - pt = 0; - data=(double**)malloc(size*sizeof(double*)); - result=(long*)malloc(size*sizeof(long)); +__AQEXPORT__(bool) fit(ColRef> X, ColRef y){ + if(X.size != y.size)return 0; + double** data = (double**)malloc(X.size*sizeof(double*)); + long* result = (long*)malloc(y.size*sizeof(long)); + for(long i=0; i