#include "Evaluation.h" #include #include #include struct minEval{ double value; double 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){ double max = data[d[size-1]][col]; minEval ret; ret.eval = DBL_MAX; long i, j; long count[classes]; long total = 0; for(i=0; igini1){ ret.eval = gini1; ret.value = c; ret.left = total; } } return ret; } minEval entropySparse(double** data, long* result, long* d, long size, long col, long classes, long* totalT){ double max = data[d[size-1]][col]; minEval ret; ret.eval = DBL_MAX; long i, j; long count[classes]; long total = 0; for(i=0; ientropy1){ ret.eval = entropy1; ret.value = c; ret.left = total; } } return ret; } minEval giniSparseIncremental(long sizeTotal, long classes, double* newSortedData, long* newSortedResult, long* T){ long l, r, i, j; minEval ret; ret.eval = DBL_MAX; double gini1, gini2; long count[classes]; long total = 0; for(i=0; igini1){ ret.eval = gini1; ret.value = c; } } return ret; } minEval entropySparseIncremental(long sizeTotal, long classes, double* newSortedData, long* newSortedResult, long* T){ long l, r, i, j; minEval ret; ret.eval = DBL_MAX; double e1, e2; long count[classes]; long total = 0; for(i=0; ie1){ ret.eval = e1; ret.value = c; } } return ret; } minEval giniDense(long max, long size, long classes, long** rem, long* d, double* record, long* totalT){ minEval ret; ret.eval = DBL_MAX; double gini1, gini2; long *t, *t2, *r, *r2, i, j; for(i=0;i0){ t2 = rem[d[i-1]]; for(j=0;j<=classes;j++){ t[j]+=t2[j]; } } if(t[classes]>=size)break; gini1 = 1.0; gini2 = 1.0; for(j=0;j0){ t2 = rem[d[i-1]]; for(j=0;j<=classes;j++){ t[j]+=t2[j]; } } if(t[classes]>=size)break; entropy1 = 0; entropy2 = 0; for(j=0;j