hi all, hoo, @#%& this sure took a lot of work, nearly a day. it was murphys law all over again so to speak.
wanted to do some multiple regression in ruby. simple right?
1st, it was very hard to install the library. the main library for this seems to be called
statsample, have not heard of it before. its a so-called “gem” ie standard ruby library. tried installing it with an earlier version of ruby on win7. it took quite awhile. the first problem was trying to do it thru a proxy server, and the http call was failing with a weird error msg. next the
daru library version seemed to be incompatible, so uninstalled the
daru version and installed an earlier version. (man it sure has a lot of dependent libraries!)
and then it took awhile to figure out how the examples worked. the code snippets in the documentation didnt seem to have the right syntax. huh? how were they compiled/ run? who knows? lets just assume everyone knows that, its so obvious right? so hunted down other examples & eventually/ finally got one to work.
then my win7 computers SSD failed and started all over again with win10. then the new ruby gem installer failed (this time in a similar yet completely different way) with a weird error msg and apparently due to a bug where the gem site was using a new more secure certificate. @#$% so isnt there a simple way to disable HTTPS fetch? oh, not really. some ppl mentioned how to do that but it didnt work either. had to reinstall the entire ruby gem app. and still a bit nervous and not fully confident because it got the same proxy fetch error (apparently?) right at the end of the install. 😡
it looks like a lot of pkgs may not work right on windows, saw these error msgs cited with rails installs and some of the advice given was “avoid windows” lol
now it turns out the ruby statsample app has a “DSL” or domain specific language and its hard to figure out how to call it directly via the class interface and not thru the DSL because all the examples, currently over 6 years old, are entirely written in the DSL. here is an example of working DSL code, but did not want to use this interface or call in batch processing mode. another annoyance is that the pkg takes a long ~7s just to initialize.
then was trying to understand why simple/ basic functions like
to_scale were not working/ setup. it seems the GSL library was “off” but cant figure out why. also couldnt call the
Statsample::Dataset class directly, it was apparently not defined. still have no idea why not…
yet another hassle was trying to fetch the coefficients programmatically… seems to be undocumented… its not like anyone would wanna do that, right? it took a long time to just figure the coefficients out and oh the constant is fetched with a different function than the coefficients which took more painstaking hunting around. so clever! 😡
anyway after poking all over the documentation pages and examples, this code finally worked after easily more than a day of total effort and here is the output! quite an achievement eh? its one of those common cases in coding where the code is simple but the path to it can be very convoluted.
really wondering if all this stuff is easier in python? it does seem to be evolving into the more standardized data scientist system.
anyway, though, finally, viola, its alive… & doncha just luv that word “regression”? 😈
(some small silver lining: google + stackexchange can be a really killer combination. several times found the hard install problems cited on stackexchange and it would have surely taken far longer otherwise, if even possble…)
and this post attempts to document it all a bit more as google bait/ fodder for the next poor soul who comes along attempting to do the same thing… 😳
- 1. Module: Statsample::Regression::Multiple
- 2. ruby-statsample’s statsample-1.0.1 Documentation
- 3. Documentation for sciruby/statsample (master)
- 4. SocketError when trying to install Ruby Gems for windows XP – Stack Overflow
- 5. statsample/multiple_regression.rb at master · clbustos/statsample · GitHub
- 6. GitHub – clbustos/statsample: A suite for basic and advanced statistics on Ruby.
- 7. Ruby Library for doing Linear or NonLinear Least Squares Approximation? – Stack Overflow
- 8. statsample | RubyGems.org | your community gem host
- 9. ruby on rails – Gem error to install – Stack Overflow
- 10. ruby on rails – SSL Error When installing rubygems, Unable to pull data from ‘https://rubygems.org/ – Stack Overflow
- 11. Download RubyGems | RubyGems.org | your community gem host
- 12. ruby – Argument should be a vector – Stack Overflow