Re: [Rd] for help on building a R package with several R function and a bunch of c, c++
On 03/06/2010 03:27 AM, alex46...@yahoo.com wrote: I think the first question should be how to build a R function to call a bunch of C ,C++ which include one main program, and a makefile. My goal to build a R package will be next step. You should jump straight to making a package. You are making you life difficult with this main program makefile model. Install Rcpp and try to use the Rcpp.package.skeleton, this will create a simple package that uses some C++ classes from Rcpp, as well as an R function that calls them. I read Rcpp , I am not sure if RcppResultSet can solve my problem or other function. Once I make sure it work I need ask UNIX adminstrator to install it. We don't know what your problem is. We can answer a question, but we cannot guess the question for you. Rcpp works, please refer to our unit tests, for example look at this vignette: http://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-unitTests.pdf I think it shouldn't be very complex, as I know to build a R function easy with one C function. Thanks you for yout attention! Alex --- On Fri, 3/5/10, Dirk Eddelbuettele...@debian.org wrote: From: Dirk Eddelbuettele...@debian.org Subject: Re: [Rd] for help on building a R package with several R function and a bunch of c, c++ To: alex46...@yahoo.com Cc: r-devel@r-project.org Date: Friday, March 5, 2010, 8:25 PM On 5 March 2010 at 13:15, alex46...@yahoo.com wrote: | Hope I can get quick help from here, I have a bunch of c, c++ included main function and makefile. It works well on both UNIX and windows. I tried to build R package which include this C++ program and several other R functions. These R function here are independent of c++ code. I prefer to define one R function to call this c++ program (main function). | | I know how to build R package with just R function, but I don't know how to handle those c++ c code after I copied those code in ./src, I am reading manual Writing R Extensions , but I did n't catch the key point . Do you know any easy way to do it? , When you asked _that exact same question_ this morning on r-help, you got the following answer: From: Whit Armstrongarmstrong.w...@gmail.com To: alex46...@yahoo.com Cc: r-h...@r-project.org Subject: Re: [R] for help on building a R package with several R function and a bunch of c, c++ Date: Fri, 5 Mar 2010 10:33:54 -0500 Pick up Rcpp, make your life easier. http://dirk.eddelbuettel.com/code/rcpp.html -Whit On Fri, Mar 5, 2010 at 9:19 AM,alex46...@yahoo.com wrote: Hope I can get quick help from here, I have a bunch of c, c++ included main function and makefile. It works well on both UNIX and windows. I tried to build R package which include this C++ program and several other R functions. R function here are independent c++ code. I prefer to define one R function to call this c++ program. Do you know any easy way to do it? I am reading manual Writing R Extensions, I didn't catch the key point. I know how to build R package with just R function, If I put all c++ code and makefile in /src...what I need do? Thank you in advance! Alex Now, can you let us know a) what part of the answer was unclear to you, and b) what made you think you needed to repost _the identical question_ here | Thank you in advance! You're welcome. Dirk -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] duplicate STRSXP : shallow copy ?
Hello, As this little program illustrates, duplicating a STRSXP does not seem deep enough. require( inline ) fx - cfunction( signature( x = character), ' SEXP y = PROTECT( duplicate( x ) ); int n = LENGTH(x); int nc = 0 ; char* p = 0 ; for( int i=0; in; i++){ p = (char*)( CHAR( STRING_ELT( y , i ) ) ); nc = strlen( p ) ; for( int j=0; jnc; j++){ p[j] = tolower( p[j] ) ; } } SEXP res = PROTECT( allocVector( VECSXP, 2 ) ); SET_VECTOR_ELT( res, 0, x ); SET_VECTOR_ELT( res, 1, y ); UNPROTECT(2) ; return res ; ', includes = #include ctype.h ) I get : fx( c(Tick, Tack, Tock ) ) [[1]] [1] tick tack tock [[2]] [1] tick tack tock where I would expect the second element of the list to not be modified. Is this intended ? If not, I can track it down to the DUPLICATE_ATOMIC_VECTOR in duplicate.c and submit a patch. Also, CHARSXP don't seem to be actually duplicated : case CHARSXP: return s; Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] duplicate STRSXP : shallow copy ?
Hello, I understand now that this is very intended after reading: http://cran.r-project.org/doc/manuals/R-ints.html#The-CHARSXP-cache So we are not supposed to modify a CHARSXP character by character. Sorry for the noise. Romain On 03/07/2010 10:48 AM, Romain Francois wrote: Hello, As this little program illustrates, duplicating a STRSXP does not seem deep enough. require( inline ) fx - cfunction( signature( x = character), ' SEXP y = PROTECT( duplicate( x ) ); int n = LENGTH(x); int nc = 0 ; char* p = 0 ; for( int i=0; in; i++){ p = (char*)( CHAR( STRING_ELT( y , i ) ) ); nc = strlen( p ) ; for( int j=0; jnc; j++){ p[j] = tolower( p[j] ) ; } } SEXP res = PROTECT( allocVector( VECSXP, 2 ) ); SET_VECTOR_ELT( res, 0, x ); SET_VECTOR_ELT( res, 1, y ); UNPROTECT(2) ; return res ; ', includes = #include ctype.h ) I get : fx( c(Tick, Tack, Tock ) ) [[1]] [1] tick tack tock [[2]] [1] tick tack tock where I would expect the second element of the list to not be modified. Is this intended ? If not, I can track it down to the DUPLICATE_ATOMIC_VECTOR in duplicate.c and submit a patch. Also, CHARSXP don't seem to be actually duplicated : case CHARSXP: return s; Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] application to mentor syrfr package development for Google Summer of Code 2010
Per http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010 -- and http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- I am applying to mentor the Symbolic Regression for R (syrfr) package for the Google Summer of Code 2010. I propose the following test which an applicant would have to pass in order to qualify for the topic: 1. Describe each of the following terms as they relate to statistical regression: categorical, periodic, modular, continuous, bimodal, log-normal, logistic, Gompertz, and nonlinear. 2. Explain which parts of http://bit.ly/tablecurve were adopted in SigmaPlot and which weren't. 3. Use the 'outliers' package to improve a regression fit maintaining the correct extrapolation confidence intervals as are between those with and without outlier exclusions in proportion to the confidence that the outliers were reasonably excluded. (Show your R transcript.) 4. Explain the relationship between degrees of freedom and correlated independent variables. Best regards, James Salsman jsals...@talknicer.com http://talknicer.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] for help on building a R package with several R function and a bunch of c, c++
Thank you for your help. So far what I did on my notebook as follows. My OS is windows7.  I downloaded Rcpp windows version, and load library(Rcpp) then.  1, Change main funnction to f1.cpp, remove makefile. 2 ,run Rcpp.package.skeleton(name=test,list=c(rec1.R,rect2.R)) 3, edit  /man, /R, copied my exist file whch I have done sucessfully without any c++ program before. 4, copy f1.cpp and all other related cpp and c into /src/ 5. Rcmd build --binary test  It showed--  making DLL gcc -lâC:/PROGRA~2/R/R-210~1.1/include,âC:/PROGRA~2/R/R-210~1.1/bin/Rscript -e' Rcpp:::CxxxFlags'` -03 -Wall -std =gnu -999 -c cranbombind.c -o cranbombind.o  gcc.exe: **\Documents/R/win-library/2.10/Rcpp/lib: No such file or directory... I checked the path, it did have C:\Users\alex **\Documents\R\win-library\2.10\Rcpp\lib  I don't know how I can fix the problem. do you think it could be problem there is a space between my first name and last name..  All I tried are on my own PC at home , I will tryon other  PC in my office.  Do you have suggestion?. Thanks,  Alex --- On Sun, 3/7/10, Romain Francois rom...@r-enthusiasts.com wrote: From: Romain Francois rom...@r-enthusiasts.com Subject: Re: [Rd] for help on building a R package with several R function and a bunch of c, c++ To: alex46...@yahoo.com Cc: Dirk Eddelbuettel e...@debian.org, r-devel@r-project.org Date: Sunday, March 7, 2010, 3:59 AM On 03/06/2010 03:27 AM, alex46...@yahoo.com wrote: I think the first question should be how to build a R function to call a bunch of C ,C++ which include one main program, and a makefile. My goal to build a R package will be next step. You should jump straight to making a package. You are making you life difficult with this main program makefile model. Install Rcpp and try to use the Rcpp.package.skeleton, this will create a simple package that uses some C++ classes from Rcpp, as well as an R function that calls them. I read Rcpp , I am not sure if RcppResultSet can solve my problem or other function. Once I make sure it work I need ask UNIX adminstrator to install it. We don't know what your problem is. We can answer a question, but we cannot guess the question for you. Rcpp works, please refer to our unit tests, for example look at this vignette: http://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-unitTests.pdf I think it shouldn't be very complex, as I know to build a R function easy with one C function. Thanks you for yout attention! Alex --- On Fri, 3/5/10, Dirk Eddelbuettele...@debian.org wrote: From: Dirk Eddelbuettele...@debian.org Subject: Re: [Rd] for help on building a R package with several R function and a bunch of c, c++ To: alex46...@yahoo.com Cc: r-devel@r-project.org Date: Friday, March 5, 2010, 8:25 PM On 5 March 2010 at 13:15, alex46...@yahoo.com wrote: | Hope I can get quick help from here, I have a bunch of c, c++ included main function and makefile. It works well on both UNIX and windows. I tried to build R package which include this C++ program and several other R functions. These R function here are independent of c++ code. I prefer to define one R function to call this c++ program (main function). | | I know how to build R package with just R function, but I don't know how to handle those c++ c code after I copied those code in ./src, I am reading manual Writing R Extensions , but I did n't catch the key point . Do you know any easy way to do it? , When you asked _that exact same question_ this morning on r-help, you got the following answer:     From: Whit Armstrongarmstrong.w...@gmail.com     To: alex46...@yahoo.com     Cc: r-h...@r-project.org     Subject: Re: [R] for help on building a R package with several R function and a bunch of c, c++     Date: Fri, 5 Mar 2010 10:33:54 -0500     Pick up Rcpp, make your life easier.     http://dirk.eddelbuettel.com/code/rcpp.html     -Whit     On Fri, Mar 5, 2010 at 9:19 AM,alex46...@yahoo.com wrote:      Hope I can get quick help from here, I have a bunch of c, c++ included main function and makefile. It works well on both UNIX and windows. I tried to build R package which include this C++ program and several other R functions. R function here are independent c++ code. I prefer to define one R function to call this c++ program.          Do you know any easy way to do it? I am reading manual Writing R Extensions, I didn't catch the key point. I know how to build R package with just R function, If I put all c++ code and makefile in /src...what I need do?          Thank you in advance!          Alex Now, can you let us know    a) what part of the answer was unclear to you, and    b) what made you think you needed to repost _the identical question_ here | Thank you in advance! You're welcome. Dirk --
Re: [Rd] application to mentor syrfr package development for Google Summer of Code 2010
It's been a while since I proposed syrfr and I have been constantly in contact with the many people in the R community and I wasn't able to find a mentor for the project. I later got interested in the Automatic Differentiation proposal (adinr) and, on consulting with a few others within the R community, I mailed John Nash (who proposed adinr in the first place) if he'd be willing to take me up on the project. I got a positive reply only a few hours ago and it was my mistake to have not removed the syrfr proposal in time from the wiki, as being listed under proposals looking for mentors. While I appreciate your interest in the syrfr proposal I am afraid my allegiances have shifted towards the adinr proposal, as I got convinced that it might interest a larger group of people and it has wider scope in general. I apologize for having caused this trouble. Best Regards, Chillu On Mon, Mar 8, 2010 at 6:41 AM, James Salsman jsals...@talknicer.comwrote: Per http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010 -- and http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- I am applying to mentor the Symbolic Regression for R (syrfr) package for the Google Summer of Code 2010. I propose the following test which an applicant would have to pass in order to qualify for the topic: 1. Describe each of the following terms as they relate to statistical regression: categorical, periodic, modular, continuous, bimodal, log-normal, logistic, Gompertz, and nonlinear. 2. Explain which parts of http://bit.ly/tablecurve were adopted in SigmaPlot and which weren't. 3. Use the 'outliers' package to improve a regression fit maintaining the correct extrapolation confidence intervals as are between those with and without outlier exclusions in proportion to the confidence that the outliers were reasonably excluded. (Show your R transcript.) 4. Explain the relationship between degrees of freedom and correlated independent variables. Best regards, James Salsman jsals...@talknicer.com http://talknicer.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] application to mentor syrfr package development for Google Summer of Code 2010
Chillu, If I understand your concern, you want to lay the foundation for derivatives so that you can implement the search strategies described in Schmidt and Lipson (2010) -- http://www.springerlink.com/content/l79v2183725413w0/ -- is that right? It is not clear to me how well this generalized approach will work in practice, but there is no reason not to proceed in parallel to establish a framework under which you could implement the metrics proposed by Schmidt and Lipson in the contemplated syrfr package. I have expanded the test I proposed with two more questions -- at http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- specifically: 5. Critique http://sites.google.com/site/gptips4matlab/ 6. Use anova to compare the goodness-of-fit of a SSfpl nls fit with a linear model of your choice. How can your characterize the degree-of-freedom-adjusted goodness of fit of nonlinear models? I believe pairwise anova.nls is the optimal comparison for nonlinear models, but there are several good choices for approximations, including the residual standard error, which I believe can be adjusted for degrees of freedom, as can the F statistic which TableCurve uses; see: http://en.wikipedia.org/wiki/F-test#Regression_problems Best regards, James Salsman On Sun, Mar 7, 2010 at 7:35 PM, Chidambaram Annamalai quantumeli...@gmail.com wrote: It's been a while since I proposed syrfr and I have been constantly in contact with the many people in the R community and I wasn't able to find a mentor for the project. I later got interested in the Automatic Differentiation proposal (adinr) and, on consulting with a few others within the R community, I mailed John Nash (who proposed adinr in the first place) if he'd be willing to take me up on the project. I got a positive reply only a few hours ago and it was my mistake to have not removed the syrfr proposal in time from the wiki, as being listed under proposals looking for mentors. While I appreciate your interest in the syrfr proposal I am afraid my allegiances have shifted towards the adinr proposal, as I got convinced that it might interest a larger group of people and it has wider scope in general. I apologize for having caused this trouble. Best Regards, Chillu On Mon, Mar 8, 2010 at 6:41 AM, James Salsman jsals...@talknicer.com wrote: Per http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010 -- and http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- I am applying to mentor the Symbolic Regression for R (syrfr) package for the Google Summer of Code 2010. I propose the following test which an applicant would have to pass in order to qualify for the topic: 1. Describe each of the following terms as they relate to statistical regression: categorical, periodic, modular, continuous, bimodal, log-normal, logistic, Gompertz, and nonlinear. 2. Explain which parts of http://bit.ly/tablecurve were adopted in SigmaPlot and which weren't. 3. Use the 'outliers' package to improve a regression fit maintaining the correct extrapolation confidence intervals as are between those with and without outlier exclusions in proportion to the confidence that the outliers were reasonably excluded. (Show your R transcript.) 4. Explain the relationship between degrees of freedom and correlated independent variables. Best regards, James Salsman jsals...@talknicer.com http://talknicer.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] application to mentor syrfr package development for Google Summer of Code 2010
If I understand your concern, you want to lay the foundation for derivatives so that you can implement the search strategies described in Schmidt and Lipson (2010) -- http://www.springerlink.com/content/l79v2183725413w0/ -- is that right? Yes. Basically traditional naive error estimators or fitness functions fail miserably when used in SR with implicit equations because they immediately close in on best fits like f(x) = x - x and other trivial solutions. In such cases no amount of regularization and complexity penalizing methods will help since x - x is fairly simple by most measures of complexity and it does have zero error. So the paper outlines such problems associated with direct error estimators and thus they infer the triviality of the fit by probing its estimates around nearby points and seeing if it does follow the pattern dictated by the data points -- ergo derivatives. Also, somewhat like a side benefit, this method also enables us to perform regression on closed loops and other implicit equations since the fitness functions are based only on derivatives. The specific form of the error is equation 1.2 which is what, I believe, comprises of the internals of the evaluation procedure used in Eureqa. You are correct in pointing out that there is no reason to not work in parallel, since GAs generally have a more or less fixed form (evaluate-reproduce cycle) which is quite easily parallelized. I have used OpenMP in the past, in which it is fairly trivial to parallelize well formed for loops. Chillu It is not clear to me how well this generalized approach will work in practice, but there is no reason not to proceed in parallel to establish a framework under which you could implement the metrics proposed by Schmidt and Lipson in the contemplated syrfr package. I have expanded the test I proposed with two more questions -- at http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- specifically: 5. Critique http://sites.google.com/site/gptips4matlab/ 6. Use anova to compare the goodness-of-fit of a SSfpl nls fit with a linear model of your choice. How can your characterize the degree-of-freedom-adjusted goodness of fit of nonlinear models? I believe pairwise anova.nls is the optimal comparison for nonlinear models, but there are several good choices for approximations, including the residual standard error, which I believe can be adjusted for degrees of freedom, as can the F statistic which TableCurve uses; see: http://en.wikipedia.org/wiki/F-test#Regression_problems Best regards, James Salsman On Sun, Mar 7, 2010 at 7:35 PM, Chidambaram Annamalai quantumeli...@gmail.com wrote: It's been a while since I proposed syrfr and I have been constantly in contact with the many people in the R community and I wasn't able to find a mentor for the project. I later got interested in the Automatic Differentiation proposal (adinr) and, on consulting with a few others within the R community, I mailed John Nash (who proposed adinr in the first place) if he'd be willing to take me up on the project. I got a positive reply only a few hours ago and it was my mistake to have not removed the syrfr proposal in time from the wiki, as being listed under proposals looking for mentors. While I appreciate your interest in the syrfr proposal I am afraid my allegiances have shifted towards the adinr proposal, as I got convinced that it might interest a larger group of people and it has wider scope in general. I apologize for having caused this trouble. Best Regards, Chillu On Mon, Mar 8, 2010 at 6:41 AM, James Salsman jsals...@talknicer.com wrote: Per http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010 -- and http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- I am applying to mentor the Symbolic Regression for R (syrfr) package for the Google Summer of Code 2010. I propose the following test which an applicant would have to pass in order to qualify for the topic: 1. Describe each of the following terms as they relate to statistical regression: categorical, periodic, modular, continuous, bimodal, log-normal, logistic, Gompertz, and nonlinear. 2. Explain which parts of http://bit.ly/tablecurve were adopted in SigmaPlot and which weren't. 3. Use the 'outliers' package to improve a regression fit maintaining the correct extrapolation confidence intervals as are between those with and without outlier exclusions in proportion to the confidence that the outliers were reasonably excluded. (Show your R transcript.) 4. Explain the relationship between degrees of freedom and correlated independent variables. Best regards, James Salsman jsals...@talknicer.com http://talknicer.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative
Re: [Rd] for help on building a R package with several R function and a bunch of c, c++
Hi, Yes, the problem is with spaces in path names. This has been fixed and will appear as Rcpp 0.7.8 in a few days. If you are in a rush, you can build it from svn, or quote the path that is returned from CxxFlags. Feel free to get back to us with more questions, although I'd encourage you to use the dedicated Rcpp-devel mailing list : https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel Romain On 03/08/2010 04:20 AM, alex46...@yahoo.com wrote: Thank you for your help. So far what I did on my notebook as follows. My OS is windows7.  I downloaded Rcpp windows version, and load library(Rcpp) then.  1, Change main funnction to f1.cpp, remove makefile. 2 ,run Rcpp.package.skeleton(name=test,list=c(rec1.R,rect2.R)) 3, edit  /man, /R, copied my exist file whch I have done sucessfully without any c++ program before. 4, copy f1.cpp and all other related cpp and c into /src/ 5. Rcmd build --binary test  It showed--  making DLL gcc -l“C:/PROGRA~2/R/R-210~1.1/include,“C:/PROGRA~2/R/R-210~1.1/bin/Rscript -e' Rcpp:::CxxxFlags'` -03 -Wall -std =gnu -999 -c cranbombind.c -o cranbombind.o  gcc.exe: **\Documents/R/win-library/2.10/Rcpp/lib: No such file or directory... I checked the path, it did have C:\Users\alex **\Documents\R\win-library\2.10\Rcpp\lib  I don't know how I can fix the problem. do you think it could be problem there is a space between my first name and last name..  All I tried are on my own PC at home , I will tryon other  PC in my office.  Do you have suggestion?. Thanks,  Alex --- On Sun, 3/7/10, Romain Francoisrom...@r-enthusiasts.com wrote: From: Romain Francoisrom...@r-enthusiasts.com Subject: Re: [Rd] for help on building a R package with several R function and a bunch of c, c++ To: alex46...@yahoo.com Cc: Dirk Eddelbuettele...@debian.org, r-devel@r-project.org Date: Sunday, March 7, 2010, 3:59 AM On 03/06/2010 03:27 AM, alex46...@yahoo.com wrote: I think the first question should be how to build a R function to call a bunch of C ,C++ which include one main program, and a makefile. My goal to build a R package will be next step. You should jump straight to making a package. You are making you life difficult with this main program makefile model. Install Rcpp and try to use the Rcpp.package.skeleton, this will create a simple package that uses some C++ classes from Rcpp, as well as an R function that calls them. I read Rcpp , I am not sure if RcppResultSet can solve my problem or other function. Once I make sure it work I need ask UNIX adminstrator to install it. We don't know what your problem is. We can answer a question, but we cannot guess the question for you. Rcpp works, please refer to our unit tests, for example look at this vignette: http://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-unitTests.pdf I think it shouldn't be very complex, as I know to build a R function easy with one C function. Thanks you for yout attention! Alex --- On Fri, 3/5/10, Dirk Eddelbuettele...@debian.org wrote: From: Dirk Eddelbuettele...@debian.org Subject: Re: [Rd] for help on building a R package with several R function and a bunch of c, c++ To: alex46...@yahoo.com Cc: r-devel@r-project.org Date: Friday, March 5, 2010, 8:25 PM On 5 March 2010 at 13:15, alex46...@yahoo.com wrote: | Hope I can get quick help from here, I have a bunch of c, c++ included main function and makefile. It works well on both UNIX and windows. I tried to build R package which include this C++ program and several other R functions. These R function here are independent of c++ code. I prefer to define one R function to call this c++ program (main function). | | I know how to build R package with just R function, but I don't know how to handle those c++ c code after I copied those code in ./src, I am reading manual Writing R Extensions , but I did n't catch the key point . Do you know any easy way to do it? , When you asked _that exact same question_ this morning on r-help, you got the following answer:     From: Whit Armstrongarmstrong.w...@gmail.com     To: alex46...@yahoo.com     Cc: r-h...@r-project.org     Subject: Re: [R] for help on building a R package with several R function and a bunch of c, c++     Date: Fri, 5 Mar 2010 10:33:54 -0500     Pick up Rcpp, make your life easier.     http://dirk.eddelbuettel.com/code/rcpp.html     -Whit     On Fri, Mar 5, 2010 at 9:19 AM,alex46...@yahoo.com wrote:    Â Hope I can get quick help from here, I have a bunch of c, c++ included main function and makefile. It works well on both UNIX and windows. I tried to build R package which include this C++ program and several other R functions. R function here are independent c++ code. I prefer to define one R function to call this c++ program.        Â Do you know any easy way to do it? I am reading manual Writing R Extensions, I didn't catch
Re: [Rd] application to mentor syrfr package development for Google Summer of Code 2010
Chillu, I meant that development on both a syrfr R package capable of using either F statistics or parametric derivatives should proceed in parallel with your work on such a derivatives package. You are right that genetic algorithm search (and general best-first search -- http://en.wikipedia.org/wiki/Best-first_search -- of which genetic algorithms are various special cases) can be very effectively parallelized, too. In any case, thank you for pointing out Eureqa -- http://ccsl.mae.cornell.edu/eureqa -- but I can see no evidence there or in the user manual or user forums that Eureqa is considering degrees of freedom in its goodness-of-fit estimation. That is a serious problem which will typically result in invalid symbolic regression. I am sending this message also to Michael Schmidt so that he might be able to comment on the extent to which Eureqa adjusts for degrees of freedom in his fit evaluations. Best regards, James Salsman On Sun, Mar 7, 2010 at 10:39 PM, Chidambaram Annamalai quantumeli...@gmail.com wrote: If I understand your concern, you want to lay the foundation for derivatives so that you can implement the search strategies described in Schmidt and Lipson (2010) -- http://www.springerlink.com/content/l79v2183725413w0/ -- is that right? Yes. Basically traditional naive error estimators or fitness functions fail miserably when used in SR with implicit equations because they immediately close in on best fits like f(x) = x - x and other trivial solutions. In such cases no amount of regularization and complexity penalizing methods will help since x - x is fairly simple by most measures of complexity and it does have zero error. So the paper outlines such problems associated with direct error estimators and thus they infer the triviality of the fit by probing its estimates around nearby points and seeing if it does follow the pattern dictated by the data points -- ergo derivatives. Also, somewhat like a side benefit, this method also enables us to perform regression on closed loops and other implicit equations since the fitness functions are based only on derivatives. The specific form of the error is equation 1.2 which is what, I believe, comprises of the internals of the evaluation procedure used in Eureqa. You are correct in pointing out that there is no reason to not work in parallel, since GAs generally have a more or less fixed form (evaluate-reproduce cycle) which is quite easily parallelized. I have used OpenMP in the past, in which it is fairly trivial to parallelize well formed for loops. Chillu It is not clear to me how well this generalized approach will work in practice, but there is no reason not to proceed in parallel to establish a framework under which you could implement the metrics proposed by Schmidt and Lipson in the contemplated syrfr package. I have expanded the test I proposed with two more questions -- at http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- specifically: 5. Critique http://sites.google.com/site/gptips4matlab/ 6. Use anova to compare the goodness-of-fit of a SSfpl nls fit with a linear model of your choice. How can your characterize the degree-of-freedom-adjusted goodness of fit of nonlinear models? I believe pairwise anova.nls is the optimal comparison for nonlinear models, but there are several good choices for approximations, including the residual standard error, which I believe can be adjusted for degrees of freedom, as can the F statistic which TableCurve uses; see: http://en.wikipedia.org/wiki/F-test#Regression_problems Best regards, James Salsman On Sun, Mar 7, 2010 at 7:35 PM, Chidambaram Annamalai quantumeli...@gmail.com wrote: It's been a while since I proposed syrfr and I have been constantly in contact with the many people in the R community and I wasn't able to find a mentor for the project. I later got interested in the Automatic Differentiation proposal (adinr) and, on consulting with a few others within the R community, I mailed John Nash (who proposed adinr in the first place) if he'd be willing to take me up on the project. I got a positive reply only a few hours ago and it was my mistake to have not removed the syrfr proposal in time from the wiki, as being listed under proposals looking for mentors. While I appreciate your interest in the syrfr proposal I am afraid my allegiances have shifted towards the adinr proposal, as I got convinced that it might interest a larger group of people and it has wider scope in general. I apologize for having caused this trouble. Best Regards, Chillu On Mon, Mar 8, 2010 at 6:41 AM, James Salsman jsals...@talknicer.com wrote: Per http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010 -- and http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010:syrfr -- I am applying to mentor the Symbolic Regression for R (syrfr) package for