-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adding a formula interface with elm
#4
Conversation
@edwindj thank you for this PR. |
@edwindj I receive the following ERROR, WARNING and NOTEs (see the attached 00check.log file) (you can ignore the WARNING about the Insufficient package version) |
(teaching today, so won't be able able to look into it, before this evening) |
Looking at the github actions, it seems to be fixed 😀 |
thank you very much @edwindj for this pull request. Give me a few days to update the CRAN version.
Let me know. thanks again. |
You re welcome! Best, Edwin |
I intended today to submit the updated version to CRAN and I ran an * checking examples ... ERROR
Running examples in ‘elmNNRcpp-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: elm
> ### Title: Fit an extreme learning model
> ### Aliases: elm
>
> ### ** Examples
>
> elm(Species ~ ., data = iris, nhid = 20, actfun="sig")
Extreme learning model, elm (classification):
call: elm(Species ~ ., data = iris, nhid = 20, actfun = "sig")
hidden units : 20
activation function: sig
accuracy : 0.9733333
confusion matrix :
predicted
observed setosa versicolor virginica
setosa 50 0 0
versicolor 0 48 2
virginica 0 2 48
>
> mod_elm <- elm(Species ~ ., data = iris, nhid = 20, actfun="sig")
>
> # predict classes
> predict(mod_elm, newdata = iris[1:3,-5])
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "elm"
Calls: predict
Execution halted
can you reproduce this error locally using the cloned repository? |
Strange, it seems to work on my machine:
git clone https://github.com/mlampros/elmNNRcpp
cd elmNNRccp
R CMD build .
R CMD check --as-cran elmNNRcpp_1.0.3.tar.gz
Furthermore, your github action:
https://github.com/mlampros/elmNNRcpp/runs/3987209967?check_suite_focus=true
seems to work for windows, linux and macos (examples do run correctly when
clicking on the output on the right).
So that's strange... Did you try `rhub::check_for_cran()` (only a
maintainer is allowed to do that)?
Best,
Edwin
Op za 23 okt. 2021 om 13:34 schreef Lampros Mouselimis <
***@***.***>:
… @edwindj <https://github.com/edwindj>,
I intended today to submit the updated version to CRAN and I ran an R CMD
check --as-cran on the cloned repository, however I receive the following
error on Linux which comes from the examples (the tests seem ok),
* checking examples ... ERROR
Running examples in ‘elmNNRcpp-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: elm
> ### Title: Fit an extreme learning model
> ### Aliases: elm
>
> ### ** Examples
>
> elm(Species ~ ., data = iris, nhid = 20, actfun="sig")
Extreme learning model, elm (classification):
call: elm(Species ~ ., data = iris, nhid = 20, actfun = "sig")
hidden units : 20
activation function: sig
accuracy : 0.9733333
confusion matrix :
predicted
observed setosa versicolor virginica
setosa 50 0 0
versicolor 0 48 2
virginica 0 2 48
>
> mod_elm <- elm(Species ~ ., data = iris, nhid = 20, actfun="sig")
>
> # predict classes
> predict(mod_elm, newdata = iris[1:3,-5])
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "elm"
Calls: predict
Execution halted
can you reproduce this error locally using the cloned repository?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEEOHBNQVI2DTIYGR4ABY3UIKMTRANCNFSM5F7CLIEQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
initially I thought the error comes from the It seems that the error comes from the auto-generated .Rd files and especially of the Examples section. Once you clone the repository can you please delete all .Rd files of the 'man' directory in the elmNNRcpp package? Then once deleted, the way I build and check a package that includes Rcpp code every time before I submit to CRAN is the following: devtools::document(pkg = '/your_default_dir/elmNNRcpp') # creates the updated .Rd files based on the .R files of the 'R' directory
remove_so_and_o_files = sapply(list.files('/your_default_dir/elmNNRcpp/src', pattern = ".o$|.so$", full.names = T), function(x) file.remove(x))
setwd('/your_default_dir/elmNNRcpp')
tools::package_native_routine_registration_skeleton(".", con = "/your_default_dir/elmNNRcpp/src/init.c", character_only = FALSE)
Rcpp::compileAttributes(verbose = T)
setwd('/your_default_dir')
system("R CMD build elmNNRcpp")
system("R CMD check --as-cran elmNNRcpp_1.0.3.tar.gz")
system("R CMD INSTALL elmNNRcpp_1.0.3.tar.gz")
I think that way you might reproduce the error compared to a simple R CMD build and check. The paths might need to be modified in the previous code snippet because they are adjusted for a unix OS |
moreover can you add @importFrom stats model.frame model.matrix terms in the elm() function @importFrom stats model.frame model.matrix in the predict.elm() function and update the DESCRIPTION file by adding the 'stats' package? Imports: Rcpp (>= 0.12.17), stats |
highly probable this error comes from the |
I submitted the updated version to CRAN (1.0.4). This was actually a problem with the R version I used. After updating to 4.1.1 the issue was resolved. |
Great! |
First of all, thanks for this package!
FWIW, I have added a formula interface with the function
elm
, which makes working with your package a bit smoother.(tests are included). Feel free to adapt and include it in your package
Best,
Edwin de Jonge
elm
elm
is a wrapper forelm_train
, transforms a data.frame with formula into the necessary input forelm_train
.Furthermore, the returned object has some nice printing properties:
classification
Using
predict
on aelm
object callselm_predict
with some extra's. For classification the type optioncan be used returning either class, probabilities or raw
regression
In regression the mse is returned.