UPDATE 17-08-2018: Now RGF is part of theofficialRGF repository and active development is performed there.Themlampros/RGF repository is archived.
TheRGF package is a wrapper of theRegularized Greedy Forest(RGF)python package, which also includes aMulti-coreimplementation (FastRGF). More details on the functionality of theRGF package can be found in theblog-postand in the package Documentation.
UPDATE 26-07-2018: ASingularityimage file is available in case that someone intends to runRGF on Ubuntu Linux (locally or in a cloud instance) with allpackage requirements pre-installed. This allows the user to utilize theRGF package without having to spend time on the installationprocess.
References:
Rie Johnson and Tong Zhang,Learning Nonlinear Functions Using Regularized Greedy Forest
All modules should be installed in the default python configuration(the configuration that the R-session displays as default), otherwiseerrors will occur during theRGF package installation(reticulate::py_discover_config() might be usefulhere).
First install / upgrade the dependencies,
sudo pip install--upgrade pip setuptoolssudo pip install-U numpysudo pip install--upgrade scipysudo pip install-U scikit-learnThen, download thergf-python package and install it usingthe following commands,
git clone https://github.com/RGF-team/rgf.gitcd rgf/python-packagesudo python setup.py installFastRGF will be installed successfully only if gcc >=5.0.
Upgrade python to version 3 using,
brew upgrade pythonThen install the dependencies forRGF andFastRGF
sudo pip3 install--upgrade setuptoolssudo pip3 install-U numpysudo pip3 install--upgrade scipysudo pip3 install-U scikit-learnTheFastRGF module requires a gcc >= 8.0. To installgcc-8 (or the most recent gcc) with brew follow the nextsteps,
# before running the following commands make sure that the most recent Apple command line tools for Xcode are installedbrew updatebrew upgradebrew info gccbrew install gccbrew cleanupAfter the newest gcc version is installed the user should navigate to/usr/local/bin and if agcc file exists (symboliclink) then the user should delete it. Then the user should run thefollowing command,
sudo ln-s/usr/local/bin/gcc-8/usr/local/bin/gccThe user should then verify that the gcc has been updated using,
gcc-vwhich gccAfter the new gcc is installed the user should continue with theinstallation ofrgf_python,
git clone https://github.com/RGF-team/rgf.gitcd/rgf/RGF/buildexport CXX=/usr/local/bin/g++-8&& export CC=/usr/local/bin/gcc-8cmake/rgf/RGF/rgf/FastRGFmakesudo make installcd/rgf/python-packagesudo python3 setup.py installAfter a successful rgf-python installation the user should open an Rsession and give the followingreticulate command to change tothe relevant (brew-python) directory (otherwise the RGF package won’twork properly),
reticulate::use_python('/usr/local/bin/python3')and then,
reticulate::py_discover_config()to validate that a user is in the python version whereRGForFastRGF are installed. Then,
install.packages(RGF)library(RGF)to load the R package. It is possible that the following warning inthe R session appears ifFastRGF is not installed,
UserWarning: Cannot find FastRGF executable files. FastRGF estimators will be unavailablefor usage.warnings.warn("Cannot find FastRGF executable files. FastRGF estimators will be unavailable for usage.")NOTE : CURRENTLY THE PACKAGE ON WINDOWS CAN BE USED ONLY FROMTHE COMMAND LINE (cmd)
First download ofget-pip.py forwindows
Update the Environment variables ( Control Panel >> System andSecurity >> System >> Advanced system settings >>Environment variables >> System variables >> Path >>Edit ) by adding ( for instance in case of python 3 ),
C:\Python36;C:\Python36\ScriptsInstall theBuildTools for Visual Studio
Open the Command prompt (console) and install thergf_pythondependencies,
pip3 install--upgrade setuptoolspip3 install-U numpypip3 install--upgrade scipypip3 install-U scikit-learnThen downloadgit for windows,
https://git-scm.com/download/winand run the downloaded.exe file. Then do,
git clone https://github.com/RGF-team/rgf.gitFastRGF requires a gcc version > 5.0 . To find out thegcc version, open a command prompt (console) and type,
gcc--versionInstallation / Upgrade of MinGW
Perform the following steps to upgrade the MinGW (so thatsimple RGF functions work – but not FastRGF)
Normally MinGW is installed in theC:\ directory.So, first delete the folderC:\MinGW (if it alreadyexists), and then remove the environment variable from (Control Panel>> System and Security >> System >> Advanced systemsettings >> Environment variables >> System variables>> Path >> Edit) which usually isC:\MinGW\bin. Then download the most recent version ofMinGW, andespecially themingw-get-setup.exe which is anautomated GUI installer assistant. After the new version isinstalled successfully, update the environment variable by addingC:\MinGW\bin in (Control Panel >> System andSecurity >> System >> Advanced system settings >>Environment variables >> System variables >> Path >>Edit). Then open a new command prompt (console) and type,
gcc--versionto find out if the new version ofMinGW is installedproperly.
A word of caution, IfRtools is already installed then makesure that it does not point to an older version of gcc. Just observe thePath field of theenvironment variables (accessible asexplained previously).
Perform the following steps only in case that a FastRGFinstallation is desired and gcc version is < 5.0
FastRGF works only withMinGW-w64 becauseonly this version provides POSIX threads. It can be downloaded from theproject’sofficialSourceForge page. After a successful download and installation theuser should also update the environment variables field in (ControlPanel >> System and Security >> System >> Advancedsystem settings >> Environment variables >> System variables>> Path >> Edit) by adding the following path (assuming thesoftware is installed inC:\Program Files (x86)folder),
C:\ProgramFiles (x86)\mingw-w64\i686-7.2.0-posix-dwarf-rt_v5-rev1\mingw32\binInstallation of cmake
First download cmake for Windows,win64-x64 Installer. Once thefile is downloaded run the.exe file and duringinstallation make sure toadd CMake to the system PATH for allusers.
Before the installation ofrgf I might have to removeRtools environment variables, such asC:\Rtools\bin (accessible as explained previously),otherwise errors might occur.
Installation of RGF, FastRGF and rgf_python [assuming the installation takes place in thec:/directory ]
Open a console withadministrator privileges (rightclick on cmd andrun as administrator), then
# download the most recent version of rgf-python from the GitHub repository#--------------------------------------------------------------------------git clone http://github.com/RGF-team/rgf.git# then navigate to#-----------------cd/rgf/RGF/mkdir bincd c:/# then download the latest "rgf.exe" from https://github.com/RGF-team/rgf/releases and place the "rgf.exe" inside the previously created "bin" folder ( /rgf/RGF/bin )# installation of RGF#--------------------cd/rgf/RGF/buildmingw32-makecd c:/# installation of FastRGF#------------------------cd/rgf/FastRGF/mkdir buildcd build# BEFORE PROCEEDING WITH cmake MAKE SURE THAT THE "Rtools" folder IS NOT IN THE SAME DIRECTORY (IF THAT IS THE CASE THEN REMOVE IT TEMPORARILY, i.e. copy-paste the "Rtools" folder somewhere else)cmake ..-G"MinGW Makefiles"mingw32-makemingw32-make installcd c:/# IF APPLICABLE, PASTE THE "Rtools" FOLDER IN THE INITIAL LOCATION / DIRECTORY# installation of rgf-python#---------------------------cd rgf/python-packagepython setup.py installThen open a command prompt (console) and type,
pythonto launchPython and then type
import rgfexit()to observe ifrgf is installed properly. Then continue withthe installation of the RGF package,
install.packages(RGF)On windows the user can take advantage of the RGF package currentlyonly from within the command prompt (console). First,find the full path of the installation location of R (possible ifsomeone right-clicks in the R short-cut (probably on Desktop) andnavigates to properties >> shortcut >> target). In case, forinstance, that R is located inC:\ProgramFiles\R\R-3.4.0\bin\x64\R, then, by opening a command prompt(console) and giving,
cd C:\Program Files\R\R-3.4.0\bin\x64\Rlibrary(RGF)one can proceed with the usage of the RGF package.
To install the package from CRAN use,
install.packages('RGF')and to download the latest version from GitHub use theinstall_github function of the devtools package,
devtools::install_github(repo ='RGF-team/rgf',subdir ='R-package')
Use the following link to report bugs/issues,
https://github.com/RGF-team/rgf/issues
If you use the code of this repository in your paper or researchplease cite bothRGF and theoriginal articles/ software: