Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R-package #208

Merged
merged 33 commits into from
Aug 17, 2018
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dc0467d
added the RGF R-package
mlampros Jul 27, 2018
177c9ec
removed empty dir
StrikerRUS Jul 30, 2018
2e7a335
added submodule
StrikerRUS Jul 30, 2018
7848cb7
unsubmodule
StrikerRUS Jul 30, 2018
7904f2e
moved files in appropriate folder
StrikerRUS Jul 30, 2018
561e9e7
fixed DESCRIPTION FILE
mlampros Jul 31, 2018
ac9132b
Revert "fixed DESCRIPTION FILE"
StrikerRUS Jul 31, 2018
f4fc73d
Merge remote-tracking branch 'upstream/master'
StrikerRUS Jul 31, 2018
fb293ac
I updated the DESCRIPTION file
mlampros Aug 1, 2018
ee359ab
I updated the R package files as suggested
mlampros Aug 2, 2018
bb0fefb
I updated the R package files as suggested
mlampros Aug 2, 2018
4a11583
I updated the R package suggested
mlampros Aug 2, 2018
dea3ead
I updated the R package as suggested
mlampros Aug 2, 2018
423fa5e
I updated the R package as suggested
mlampros Aug 2, 2018
0f67f49
I updated the R package as suggested
mlampros Aug 3, 2018
4654f93
I updated the R package as suggested
mlampros Aug 3, 2018
b13150a
I updated the R package as suggested
mlampros Aug 3, 2018
a781553
I updated the R package as suggested
mlampros Aug 3, 2018
b153174
I updated the R package as suggested
mlampros Aug 3, 2018
6c53fec
I updated the R package as suggested
mlampros Aug 4, 2018
edea4ed
added R-package test at Travis
StrikerRUS Aug 4, 2018
a2a3798
fixed conflicts
StrikerRUS Aug 4, 2018
430df8d
fixed R test at Travis
StrikerRUS Aug 7, 2018
25e5986
fixed conflicts in library versions
StrikerRUS Aug 8, 2018
374e9bf
updated the DESCRIPTION and NEWS files
mlampros Aug 9, 2018
34336fd
Merge branch 'master' of https://github.com/mlampros/rgf-1
mlampros Aug 9, 2018
4ca872e
updated the R-package files
mlampros Aug 10, 2018
4470326
updated the R-package files
mlampros Aug 14, 2018
f8d8ab5
fixed arxiv.org certificate error
StrikerRUS Aug 14, 2018
4c9e9ff
replaced problem link to r-pkg.org with link to package official page…
StrikerRUS Aug 14, 2018
bd9b118
fixed MinGW-w64 certificates problem
StrikerRUS Aug 14, 2018
846c747
update the R-package files
mlampros Aug 15, 2018
53112f4
Merge branch 'master' of https://github.com/mlampros/rgf-1
mlampros Aug 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ os:
- osx

env:
- PYTHON_VERSION=2.7
- PYTHON_VERSION=3.4
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
global:
- R_LIB_PATH=~/Rlib
matrix:
- PYTHON_VERSION=2.7
- PYTHON_VERSION=3.4
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON_VERSION=3.6 TASK=R_PACKAGE

matrix:
exclude:
- os: osx
env: PYTHON_VERSION=3.6 TASK=R_PACKAGE

before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then
sudo softwareupdate -i "Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.3";
rm '/usr/local/include/c++';
brew install gcc;
Expand All @@ -39,21 +48,25 @@ before_install:
- RGF_VER=$(head -n 1 python-package/rgf/VERSION)

install:
- cd python-package
- cd $TRAVIS_BUILD_DIR/python-package
- python setup.py sdist --formats gztar
- pip install dist/rgf_python-$RGF_VER.tar.gz -v

script:
- pytest tests/ -v
- if [[ $TASK == "R_PACKAGE" ]]; then
bash $TRAVIS_BUILD_DIR/R-package/.R.travis.sh;
fi

before_deploy:
- cd $TRAVIS_BUILD_DIR/python-package
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then
python setup.py bdist_wheel --plat-name=any --universal;
mv dist/rgf_python-${RGF_VER}-py2.py3-none-any.whl dist/rgf_python-${RGF_VER}-py2.py3-none-macosx_10_6_x86_64.macosx_10_7_x86_64.macosx_10_8_x86_64.macosx_10_9_x86_64.macosx_10_10_x86_64.macosx_10_11_x86_64.macosx_10_12_x86_64.macosx_10_13_x86_64.whl;
else
python setup.py bdist_wheel --plat-name=manylinux1_x86_64 --universal;
python setup.py bdist_wheel --plat-name=manylinux1_i686 --universal;
cd dist;
cd $TRAVIS_BUILD_DIR/python-package/dist;
zip -d rgf_python-${RGF_VER}-py2.py3-none-manylinux1_i686.whl rgf/rgf rgf/forest_train rgf/forest_predict;
mkdir rgf;
wget https://github.com/RGF-team/rgf/releases/download/3.2.0/rgf -O rgf/rgf;
Expand All @@ -66,6 +79,10 @@ before_deploy:
notifications:
email: false

cache:
directories:
- $R_LIB_PATH

deploy:
file_glob: true
file: python-package/dist/*.whl
Expand Down
57 changes: 57 additions & 0 deletions R-package/.R.travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
mkdir -p $R_LIB_PATH
cd $TRAVIS_BUILD_DIR/R-package
echo "R_LIBS=$R_LIB_PATH" > .Renviron
echo 'options(repos = "http://cran.rstudio.com")' > .Rprofile

export PATH="$R_LIB_PATH/R/bin:$PATH"

sudo apt-get install gfortran-5
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-5 10
# use system-wide libraries (fix error "symbol _ZTINSt8ios_base7failureB5cxx11E, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference")
conda remove --force libgfortran-ng libgcc-ng libstdcxx-ng

# install packages to build and check documentation
conda install --no-deps pandoc
sudo apt-get install texlive-latex-recommended texlive-fonts-recommended texlive-fonts-extra qpdf

if ! command -v R &> /dev/null; then
R_VER=3.5.1
cd $TRAVIS_BUILD_DIR
wget https://cran.r-project.org/src/base/R-3/R-$R_VER.tar.gz
tar -xzf R-$R_VER.tar.gz
R-$R_VER/configure --enable-R-shlib --prefix=$R_LIB_PATH/R
make
make install
cd $TRAVIS_BUILD_DIR/R-package
fi

Rscript -e 'if(!"devtools" %in% rownames(installed.packages())) { install.packages("devtools", dependencies = TRUE) }'
Rscript -e 'if(!"roxygen2" %in% rownames(installed.packages())) { install.packages("roxygen2", dependencies = TRUE) }'
Rscript -e 'if(!"testthat" %in% rownames(installed.packages())) { install.packages("testthat", dependencies = TRUE) }'
Rscript -e 'if(!"knitr" %in% rownames(installed.packages())) { install.packages("knitr", dependencies = TRUE) }'
Rscript -e 'if(!"covr" %in% rownames(installed.packages())) { install.packages("covr", dependencies = TRUE) }'
Rscript -e 'if(!"rmarkdown" %in% rownames(installed.packages())) { install.packages("rmarkdown", dependencies = TRUE) }'
Rscript -e 'if(!"reticulate" %in% rownames(installed.packages())) { install.packages("reticulate", dependencies = TRUE) }'
Rscript -e 'if(!"R6" %in% rownames(installed.packages())) { install.packages("R6", dependencies = TRUE) }'
Rscript -e 'if(!"Matrix" %in% rownames(installed.packages())) { install.packages("Matrix", dependencies = TRUE) }'

Rscript -e 'update.packages(ask = FALSE, instlib = Sys.getenv("R_LIB_PATH"))'

Rscript -e 'devtools::install_deps(pkg = ".", dependencies = TRUE)'

R CMD build . || exit -1

PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
PKG_NAME="${PKG_FILE_NAME%%_*}"
LOG_FILE_NAME="$PKG_NAME.Rcheck/00check.log"

R CMD check "${PKG_FILE_NAME}" --as-cran || exit -1
if grep -q -R "WARNING" "$LOG_FILE_NAME"; then
echo "WARNINGS have been found in the build log!"
exit -1
#elif grep -q -R "NOTE" "$LOG_FILE_NAME"; then
# echo "NOTES have been found in the build log!"
# exit -1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If unnecessary, l.55-l.57 should be deleted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess @StrikerRUS should decide if this code chunk should be removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines will be uncommented right after the merging this PR. The reason is that at present there is no rgf/R-package directory and CRAN check produces a NOTE for this.

fi

Rscript -e 'covr::codecov(quiet = FALSE)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be related to codecov behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line has been here since the first commit in the PR. Before today it silently printed information to the Travis log and updated the badge, but today decided to come here in comments and post the report.

PS. it seems that registration at codecov.io isn't required and done automatically after using the package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to rollback to the previous behavior: report is printed to the Travis log and badge updates without these useless and annoying comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found the way to easily disable comments, but this PR should be merged first.

1 change: 1 addition & 0 deletions R-package/.Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^\.R\.travis\.sh$
4 changes: 4 additions & 0 deletions R-package/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
25 changes: 25 additions & 0 deletions R-package/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Package: RGF
Type: Package
Title: Regularized Greedy Forest
Version: 1.0.5
Date: 2018-08-09
Authors@R: c( person("Lampros", "Mouselimis", email = "mouselimislampros@gmail.com", role = c("aut", "cre")), person("Ryosuke", "Fukatani", role = "cph", comment = "Author of the python wrapper of the 'Regularized Greedy Forest' machine learning algorithm"), person("Tong", "Zhang", role = "cph", comment = "Author of the 'Regularized Greedy Forest' and of the Multi-core implementation of Regularized Greedy Forest machine learning algorithm"), person("Rie", "Johnson", role = "cph", comment = "Author of the 'Regularized Greedy Forest' machine learning algorithm") )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StrikerRUS Your name should be added? You are also "Author of the python wrapper of the 'Regularized Greedy Forest' machine learning algorithm".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fukatani Thank you! It'll be an honor for me.

Maintainer: Lampros Mouselimis <mouselimislampros@gmail.com>
BugReports: https://github.com/RGF-team/rgf/issues
URL: https://github.com/RGF-team/rgf/tree/master/R-package
Description: Regularized Greedy Forest wrapper of the 'Regularized Greedy Forest' <https://github.com/RGF-team/rgf/tree/master/python-package> 'python' package, which also includes a Multi-core implementation (FastRGF) <https://github.com/RGF-team/rgf/tree/master/FastRGF>.
License: MIT + file LICENSE
SystemRequirements: Python (2.7 or >= 3.4), rgf_python, scikit-learn (>= 0.18.0), scipy, numpy. Detailed installation instructions for each operating system can be found in the README file.
Depends:
R(>= 3.2.3)
Imports:
reticulate, R6, Matrix
Suggests:
testthat,
covr,
knitr,
rmarkdown
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
VignetteBuilder: knitr
2 changes: 2 additions & 0 deletions R-package/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2018
COPYRIGHT HOLDER: Mouselimis Lampros <mouselimislampros@gmail.com>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the license of the RGF R wrapper?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license is MIT. This appears in the DESCRIPTION file (License: MIT + file LICENSE)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, then please put the text of the MIT license here, because after opening LICENSE file everyone expects to see the license itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry but I can't do that. CRAN requires from R package maintainers to only mention the YEAR and the COPYRIGHT HOLDER. If I'll add the MIT text inside the LICENSE file then the package will not pass the tests and the package will not be accepted on CRAN. This is actually the reason that the DESCRIPTION file includes License: MIT + file LICENSE

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure in this? Seems that it's allowed to add test of a license. Please take a look:
https://github.com/dmlc/xgboost/blob/master/R-package/LICENSE

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an Apache license. I'm not familiar with this schema. However in case of the MIT license the approved schema is the following : ... This is a template. Complete and ship as file LICENSE the following 2 lines (only) ...

24 changes: 24 additions & 0 deletions R-package/LICENSE.note
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Regularized Greedy Forest (RGF)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


See file COPYING: https://github.com/RGF-team/rgf/blob/master/RGF/COPYING



#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Fast Regularized Greedy Forest (FastRGF)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


See file LICENSE: https://github.com/RGF-team/rgf/blob/master/FastRGF/LICENSE



#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python wrapper of RGF and FastRGF
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 blank lines at the end of the file

See file LICENSE: https://github.com/RGF-team/rgf/blob/master/python-package/LICENSE
10 changes: 10 additions & 0 deletions R-package/NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export(RGF_cleanup_temp_files)
export(mat_2scipy_sparse)
export(TO_scipy_sparse)
export(RGF_Regressor)
export(RGF_Classifier)
export(FastRGF_Regressor)
export(FastRGF_Classifier)
import(reticulate)
importFrom(R6,R6Class)
importFrom(Matrix,Matrix)
33 changes: 33 additions & 0 deletions R-package/NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## RGF 1.0.5

The RGF R package was integrated in the home repository for the Regularized Greedy Forest (RGF) library (https://github.com/RGF-team).


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove 2 blank lines at the top of the file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed and pushed changes.

## RGF 1.0.4

* We modified the license from GPL-3 to MIT to go in accordance with the new structure of the *rgf_python* package. The package includes two files : *LICENSE* (for the RGF R package) and *LICENSE.note* (for the *RGF*, *FastRGF* and *rgf_python* packages).
* We added the following new features of RGF estimators : *feature_importances_* and *dump_model()*
* We modified the README.md file and especially the installation instructions for all operating systems (Linux, Macintosh, Windows)
Copy link
Member

@fukatani fukatani Aug 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MacOS is better. It uses it even in other places, so it's easy to search.

* We created an R6 class (*Internal_class*) for all secondary functions which are used in RGF and FastRGF


## RGF 1.0.3

* The *dgCMatrix_2scipy_sparse* function was renamed to *TO_scipy_sparse* and now accepts either a *dgCMatrix* or a *dgRMatrix* as input. The appropriate format for the RGF package in case of sparse matrices is the *dgCMatrix* format (*scipy.sparse.csc_matrix*)
* We added an onload.R file to inform the users about the previous change
* Due to the previous changes we modified the Vignette and the tests too


## RGF 1.0.2

We commented the example(s) and test(s) related to the *dgCMatrix_2scipy_sparse* function [ *if (Sys.info()["sysname"] != 'Darwin')* ], because the *scipy-sparse* library on CRAN is not upgraded and the older version includes a bug (*TypeError : could not interpret data type*). This leads to an error on *Macintosh* ( *reference* : https://github.com/scipy/scipy/issues/5353 ).

Copy link
Member

@StrikerRUS StrikerRUS Aug 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Macintosh* -> *macOS*
https://en.wikipedia.org/wiki/MacOS

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry but I'm kind of retro https://en.wikipedia.org/wiki/Macintosh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macintosh is a is a family of personal computers designed, while macOS is a series of graphical operating systems developed and marketed by Apple Inc.

You're writing

This leads to an error on Macintosh Operating System

, so it should be macOS.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably here is more clearly stated https://en.wikipedia.org/wiki/Macintosh#Software. I don't use Macintosh. I use Linux on a daily basis, however I can't stand calling the Macintosh family (Hardware, Software) as MacOS. If this does not cause any problems to the rgf_python package I would rather prefer that it stays as is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, your phase

This leads to an error on Macintosh Operating System

means "Operating System which runs on Macintosh", not the name of OS, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it we have spend to much time on something not that important. If you don't mind I'll remove the 'operating system' and I'll keep only Macintosh. It will look something like this,

... type*). This leads to an error on *Macintosh* ( *reference* ...

Do you agree with this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, leave it as is.


## RGF 1.0.1

We added links to the GitHub repository (master repository, issues).


## RGF 1.0.0

Initial version.
28 changes: 28 additions & 0 deletions R-package/R/package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#-------------------------
# Load the python-modules
#-------------------------


RGF_mod <- NULL; RGF_utils <- NULL; SCP <- NULL;


.onLoad <- function(libname, pkgname) {

if (reticulate::py_available(initialize = TRUE)) {

if (reticulate::py_module_available("rgf.sklearn")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this function raise understandable error about the need of rgf installation? If not, then I think you should write else branch and do it there manually.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind I would rather keep this file intact. Otherwise it might lead to problems when I have to check-test the package on CRAN

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!


RGF_mod <<- reticulate::import("rgf.sklearn", delay_load = TRUE)
}

if (reticulate::py_module_available("rgf.utils")) {

RGF_utils <<- reticulate::import("rgf.utils", delay_load = TRUE)
}

if (reticulate::py_module_available("scipy")) {

SCP <<- reticulate::import("scipy", delay_load = TRUE, convert = FALSE)
}
}
}
Loading