diff --git a/.Rbuildignore b/.Rbuildignore index 047a1dd4..ac259abe 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,4 @@ ^travisTest$ +^docs$ ^\.travis\.yml$ ^.*\\.gz$ diff --git a/DESCRIPTION b/DESCRIPTION index f858b84c..e9831b5a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rerf Type: Package Title: Randomer Forest -Version: 1.1.2 +Version: 1.1.3 Date: 2018-07-05 Authors@R: c(person("James", "Browne", role = c("aut", "cre"), email = "jbrowne6@jhu.edu"), diff --git a/docs/subsampling/bootstrap_subsample.Rmd b/docs/subsampling/bootstrap_subsample.Rmd old mode 100644 new mode 100755 diff --git a/docs/subsampling/bootstrap_subsample.html b/docs/subsampling/bootstrap_subsample.html old mode 100644 new mode 100755 diff --git a/docs/subsampling/figure.pdf b/docs/subsampling/figure.pdf old mode 100644 new mode 100755 diff --git a/man/RerF.Rd b/man/RerF.Rd index e653fd9c..35944ab5 100644 --- a/man/RerF.Rd +++ b/man/RerF.Rd @@ -4,7 +4,7 @@ \alias{RerF} \title{RerF forest Generator} \usage{ -RerF(X, Y, min.parent = 6L, trees = 100L, +RerF(X, Y, min.parent = 6L, trees = 500L, max.depth = ceiling(log2(nrow(X))), bagging = 0.2, replacement = TRUE, stratify = FALSE, fun = NULL, mat.options = list(p = ifelse(is.null(cat.map), ncol(X), length(cat.map)), d = @@ -21,7 +21,7 @@ RerF(X, Y, min.parent = 6L, trees = 100L, \item{min.parent}{the minimum splittable node size. A node size < min.parent will be a leaf node. (min.parent = 6)} -\item{trees}{the number of trees in the forest. (trees=100)} +\item{trees}{the number of trees in the forest. (trees=500)} \item{max.depth}{the longest allowable distance from the root of a tree to a leaf node (i.e. the maximum allowed height for a tree). If max.depth=0, the tree will be allowed to grow without bound. (max.depth=ceiling(log2(nrow(X))) )} diff --git a/src/forestPacking.cpp b/src/forestPacking.cpp index 78a8c9ae..d27862cb 100644 --- a/src/forestPacking.cpp +++ b/src/forestPacking.cpp @@ -1,5 +1,6 @@ #include #include +#include // [[Rcpp::depends(RcppArmadillo)]] using namespace Rcpp; @@ -21,7 +22,7 @@ Rcpp::NumericVector predictRF(const NumericMatrix mat, const int numCores){ int numObservations = mat.nrow(); int numFeatures = mat.ncol(); - double *currObs = new double[numFeatures]; + std::vector currObs(numFeatures); Rcpp::NumericVector predictions(numObservations); const std::string packedFileName = "forest.out"; @@ -30,10 +31,8 @@ Rcpp::NumericVector predictRF(const NumericMatrix mat, const int numCores){ for(int j = 0; j < numFeatures; j++){ currObs[j] = mat(i,j); } - //predictions[i] = tester.makePrediction(currObs,numCores)+1; predictions[i] = tester.makePrediction(currObs)+1; } - delete currObs; return predictions; } diff --git a/src/forestPacking/improv8.cpp b/src/forestPacking/improv8.cpp index 030b472c..8e2d2885 100644 --- a/src/forestPacking/improv8.cpp +++ b/src/forestPacking/improv8.cpp @@ -282,6 +282,41 @@ void improv8::makePrediction(double* observation, double* preds, int numFeatures } +int improv8::makePrediction(std::vector& observation){ + + std::vector predictions(numOfClasses); + std::vector currentNode(forestRoots[0].numOfTreesInBin); + int numberNotInLeaf; + int k, q; + + for( k=0; k < numOfBins;k++){ + + for( q=0; q 0); + + for( q=0; q predictions(numOfClasses); diff --git a/src/forestPacking/improv8.h b/src/forestPacking/improv8.h index 900f4058..1ccb6ce9 100644 --- a/src/forestPacking/improv8.h +++ b/src/forestPacking/improv8.h @@ -23,6 +23,7 @@ class improv8: public padForest void makePredictions(const inferenceSamples& observations); void makePrediction(double* observation, double* preds, int numFeatures, int numObservations, int numCores); int makePrediction(double*& observation); + int makePrediction(std::vector& observation); int makePrediction(double*& observation, int numCore); void writeForest(const std::string& forestFileName); void changeNumBins(int newBinNum){