Giter Site home page Giter Site logo

sumbose / irf Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 18.0 6.3 MB

iterative Random Forests (iRF): iteratively grows weighted random forests, finds interaction among features

License: GNU General Public License v3.0

C 26.59% Fortran 5.74% R 55.39% C++ 8.61% TeX 0.53% PostScript 3.15%

irf's People

Contributors

karlkumbier avatar sumbose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

irf's Issues

[JOSS review] Installation guideline improvements

Some items in the readme on installation could be improved:

  1. It looks like the package is already available from CRAN (awesome!), so it is usually good practice to include the installation guidelines for the CRAN version in addition to the GitHub version. A simple example: https://github.com/road2stat/liftr#installation

  2. I would also suggest removing the "Alternatively, ... R CMD INSTALL" method because it is more manual and not too different from using devtools::install_github, at least for regular users who don't want to modify the source code before using the software.

  3. gfortran. I'd probably mention that to compile iRF from source, it needs gfortran, and point to the official CRAN page https://cran.r-project.org/bin/macosx/tools/ for users who want to install it under MacOS. I would also remove the command line since it doesn't handle the complexity of system versions and gfortran versions.

openjournals/joss-reviews#1077

[JOSS review] Add some unit tests

JOSS requires some automated tests or manual test instructions available in the software. Please consider following the guidelines here to create some basic unit tests for certain functions in the package.

Error in unserialize(socklist[[n]]) : error reading from connection

Hi,
Thank you for your package.

When I applyed function "iRF", an error has been reported as "Error in unserialize(socklist[[n]]) : error reading from connection".

The codes I ran are as following:

fit <- iRF(x=as.matrix(data[train.id, exposure]),
y=data[train.id,outcome],
xtest=as.matrix(data[test.id, exposure]),
ytest=data[test.id,outcome],
n.iter=10,
n.core=3,
select.iter = T,
n.bootstrap=200
)

I ran the code on windows on my own laptop. I was wondering what are the possible reasons for this?

Looking forward to your answer.

Cannot install iRF

Hey Sumanta!

I wanted to use iRF to identify interactions between some variables for one of my projects, but I can't seem to install the package. Not sure if it's supposed to be usable yet, but I just thought I'd let you know.

> devtools::install_github("sumbose/iRF")
Downloading GitHub repo sumbose/iRF@master
from URL https://api.github.com/repos/sumbose/iRF/zipball/master
Installing iRF
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/yv/wgyt24cx34j3fyxz_y4lzx380000gn/T/RtmpDc0iIZ/devtoolsc5c731328a1e/sumbose-iRF-062fb3f'  \
  --library='/Library/Frameworks/R.framework/Versions/3.3/Resources/library' --install-tests 

* installing *source* package ‘iRF’ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c classTree.c -o classTree.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c regTree.c -o regTree.o
regTree.c:184:9: warning: unused variable 'jj' [-Wunused-variable]
    int jj, jold;
        ^
regTree.c:391:14: warning: unused variable 'dum' [-Wunused-variable]
        int i, tmp, dum;
                    ^
2 warnings generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c regrf.c -o regrf.o
regrf.c:67:9: warning: unused variable 'ii' [-Wunused-variable]
    int ii, jj, tmpcheck, subsetCard;
        ^
regrf.c:67:13: warning: unused variable 'jj' [-Wunused-variable]
    int ii, jj, tmpcheck, subsetCard;
            ^
regrf.c:67:17: warning: unused variable 'tmpcheck' [-Wunused-variable]
    int ii, jj, tmpcheck, subsetCard;
                ^
3 warnings generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c rf.c -o rf.o
rf.c:471:1: warning: expression result unused [-Wunused-value]
+                                                               nrightimp[cl[n] - 1]++;
^                                                               ~~~~~~~~~~~~~~~~~~~~~~
rf.c:100:13: warning: unused variable 'jj' [-Wunused-variable]
    int ii, jj, tmpcheck, subsetCard;
            ^
rf.c:100:9: warning: unused variable 'ii' [-Wunused-variable]
    int ii, jj, tmpcheck, subsetCard;
        ^
3 warnings generated.
gfortran-4.8   -fPIC  -g -O2  -c rfsub.f -o rfsub.o
make: gfortran-4.8: No such file or directory
make: *** [rfsub.o] Error 1
ERROR: compilation failed for package ‘iRF’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/iRF’
Error: Command failed (1)

My sessionInfo() is as follows:

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.3

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] httr_1.2.1      R6_2.2.0        tools_3.3.2     withr_1.0.2     curl_2.3        memoise_1.0.0   git2r_0.18.0    digest_0.6.12   devtools_1.12.0

[JOSS review] Make vignette available online

Some documentation improvements:

  1. It is often very useful to make vignette directly readable online. The fastest way I can think of is using pkgdown and host the website with GitHub Pages.

  2. When it's ready, please add the website or vignette link (if you use GitHub Pages, it would be https://sumbose.github.io/iRF/ ) to the description section of the repo (click the "Edit" button and fill in the website address then click "Save").

  3. Add the link of the online vignette to the README.md so users know where to look to get started.

openjournals/joss-reviews#1077

Cannot install iRF from github on MacOS

Hello, Sumanta,

I want to install iRF on MacOS, and I already install gfortran to compile, but I still cannot successfully use this package, and it will show the following error after install:

> devtools::install_github("sumbose/iRF")
Downloading GitHub repo sumbose/iRF@master
✔  checking for file ‘/private/var/folders/g2/fknsdml54vsfn7k25q_j6p3h0000gn/T/RtmpQMSNbU/remotes1084d68ac7f1a/sumbose-iRF-fafed6a/DESCRIPTION’ ...
─  preparing ‘iRF’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a ‘data/datalist’ file should be added
─  building ‘iRF_3.0.0.tar.gz’
   
* installing *source* package ‘iRF’ ...
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include  -fopenmp -fPIC  -Wall -g -O2 -c ExportedFunctionsRIT.cpp -o ExportedFunctionsRIT.o
clang: error: unsupported option '-fopenmp'
make: *** [ExportedFunctionsRIT.o] Error 1
ERROR: compilation failed for package ‘iRF’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/iRF’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/iRF’
Error: Failed to install 'iRF' from GitHub:
  (converted from warning) installation of package ‘/var/folders/g2/fknsdml54vsfn7k25q_j6p3h0000gn/T//RtmpQMSNbU/file1084da4ac855/iRF_3.0.0.tar.gz’ had non-zero exit status



My sessionInfo() is as follow:

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] iRF_2.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2         pillar_1.4.2       compiler_3.5.2     RColorBrewer_1.1-2 remotes_2.1.0     
 [6] prettyunits_1.0.2  iterators_1.0.12   tools_3.5.2        testthat_2.2.1     digest_0.6.21     
[11] pkgbuild_1.0.3     pkgload_1.0.2      memoise_1.1.0      tibble_2.1.3       lattice_0.20-38   
[16] pkgconfig_2.0.3    rlang_0.4.0        Matrix_1.2-17      foreach_1.4.7      cli_1.1.0         
[21] rstudioapi_0.10    curl_3.3           parallel_3.5.2     withr_2.1.2        dplyr_0.8.3       
[26] fs_1.3.1           desc_1.2.0         AUC_0.3.0          devtools_2.2.1     rprojroot_1.3-2   
[31] grid_3.5.2         tidyselect_0.2.5   glue_1.3.1         data.table_1.12.2  R6_2.4.0          
[36] processx_3.3.1     sessioninfo_1.1.1  purrr_0.3.2        callr_3.2.0        magrittr_1.5      
[41] usethis_1.5.0      backports_1.1.4    codetools_0.2-16   ps_1.3.0           ellipsis_0.3.0    
[46] assertthat_0.2.1   doParallel_1.0.15  crayon_1.3.4  

Failed to install from Github

Thanks for the wonderful package.

Got the following error when trying to install from Github:

#error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Solved the issue by

  1. create a file named "CMakeLists.txt" in the src directory.
  2. Put this line:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

on the second line of the newly created CMakeLists.txt file.

Warning: "condition has length > 1 and only the first element will be used"

Using iRF version 3.0.0 installed yesterday from GitHub, I get this warning message:

Warning message:
In if (!class(x) %in% c("data.frame", "matrix")) { :
  the condition has length > 1 and only the first element will be used

when x is of class c("matrix", "array"). This is originating from

iRF/R/iRF.R

Lines 93 to 97 in 7476536

if (!class(x) %in% c('data.frame', 'matrix')) {
sp.mat <- attr(class(x), 'package') == 'Matrix'
if (is.null(sp.mat) || !sp.mat)
stop('x must be matrix or data frame')
}

This can be resolved by replacing class(x) %in% c("data.frame", "matrix") with is(x, c("data.frame", "matrix") here, as well as elsewhere in the code.

Example:

set.seed(42)
x <- structure(c(0.51542, 0.61489, 0.63492, 0.53612, 0.52895, 0.64572,  0.54093, 0.48915, 0.56444, 0.62533, 0.48457, 0.52632, 0.52961,  0.65015, 0.54746, 0.53074, 0.54062, 0.51413, 0.58454, 0.57131,  0.26293, 0.29376, 0.28257, 0.27655, 0.27326, 0.23358, 0.28784,  0.31006, 0.28066, 0.25501, 0.28015, 0.2786, 0.24955, 0.27152,  0.2051, 0.20854, 0.28254, 0.30097, 0.27195, 0.24717), .Dim = c(10L,  4L), .Dimnames = list(NULL, c("CGI_69.PDR.Set1", "CGI_223.PDR.Set1",  "CGI_299.PDR.Set1", "CGI_550.PDR.Set1")))
 y <- sample(factor(c("0","1")), size=10, replace=TRUE)

r <- iRF(x=x, y=y)
## [1] "iteration =  1"
## [1] "iteration =  2"
## [1] "iteration =  3"
## [1] "iteration =  4"
## [1] "iteration =  5"
## Warning message:
## In if (!class(x) %in% c("data.frame", "matrix")) { :
##   the condition has length > 1 and only the first element will be used## Warning message:

object 'X' not found

Hi,

When running the iRF function, I found that the training variable x is referred to in the body of the function as X, this is line 24 and 25 in the iRF.R code. Is this a typo?

P

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.