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

Problem with IJulia notebook and GLM.jl #244

Closed
tcfuji opened this issue Oct 25, 2014 · 7 comments
Closed

Problem with IJulia notebook and GLM.jl #244

tcfuji opened this issue Oct 25, 2014 · 7 comments

Comments

@tcfuji
Copy link

tcfuji commented Oct 25, 2014

Currently using Julia 3.1, GLM.jl 0.4 and IJulia 1.15
The following works on the Julia and IJulia console:

In [3]: lm1 = lm(OptDen ~ Carb, form)
Out[3]:
DataFrameRegressionModel{LinearModel{DensePredQR{Float64}},Float64}:

Coefficients:
               Estimate  Std.Error  t value Pr(>|t|)
(Intercept)  0.00508571 0.00783368 0.649211   0.5516
Carb           0.876286  0.0135345  64.7444    <1e-6

However, on IJulia notebook, I get the following output:

In [6]: lm1 = lm(OptDen ~ Carb, form)

`convert` has no method matching convert(::Type{Array{Symbol,1}}, ::Array{Any,1})
while loading In[6], in expression starting on line 1

 in convert at base.jl:13
 in ModelFrame at ~/.julia/DataFrames/src/statsmodels/formula.jl:238
 in fit at ~/.julia/DataFrames/src/statsmodels/statsmodel.jl:52
 in lm at ~/.julia/GLM/src/lm.jl:43
@stevengj
Copy link
Member

Can you type versioninfo() in the console and in the notebook? Maybe you are not using the same Julia version in the two cases (in which case you can fix it by typing Pkg.build("IJulia") in the console and re-launching the notebook).

@tcfuji
Copy link
Author

tcfuji commented Oct 25, 2014

I executed versioninfo() on both the console and notebook. Both produced the same output. I even executed Pkg.build("IJulia"), but lm1 = lm(OptDen ~ Carb, form) still won't give the correct output on the notebook.

@stevengj
Copy link
Member

@TFGIT, can you post a self-contained, complete code sample that exhibits your problem? @simonster, @IainNZ, can you reproduce this behavior?

@IainNZ
Copy link
Member

IainNZ commented Oct 25, 2014

using RDatasets
using GLM
form = dataset("datasets", "Formaldehyde")
lm1 = lm(OptDen ~ Carb, form)

Doesn't produce any errors for me in an IJulia notebook. Julia 0.3.0, IJulia 0.1.15, OSX 10.9

@tcfuji
Copy link
Author

tcfuji commented Oct 25, 2014

This has become more complicated...

Actually I can execute

using RDatasets
using GLM
form = dataset("datasets", "Formaldehyde")
lm1 = lm(OptDen ~ Carb, form)

in that sequence alone. However, mixed in with some other commands, I am still getting the same output. The IJulia notebook is included here: http://nbviewer.ipython.org/github/tfgit/statlearning-with-julia/blob/master/src/3.%20Linear%20Regression.ipynb

I am also getting the same output in JuliaBox: http://nbviewer.ipython.org/github/tfgit/statlearning-with-julia/blob/master/src/3.%20Linear%20Regression%20JuliaBox%20version.ipynb

My guess is that some of the prior commands may be to blame.

@simonster
Copy link
Member

I can reproduce on 0.3 from the REPL with:

julia> using Color

julia> using RDatasets

julia> using GLM
Warning: could not import Base.add! into NumericExtensions

julia> form = dataset("datasets", "Formaldehyde")
6x2 DataFrame
| Row | Carb | OptDen |
|-----|------|--------|
| 1   | 0.1  | 0.086  |
| 2   | 0.3  | 0.269  |
| 3   | 0.5  | 0.446  |
| 4   | 0.6  | 0.538  |
| 5   | 0.7  | 0.626  |
| 6   | 0.9  | 0.782  |

julia> lm1 = lm(OptDen ~ Carb, form)
ERROR: `convert` has no method matching convert(::Type{Array{Symbol,1}}, ::Array{Any,1})
 in convert at base.jl:13
 in ModelFrame at /Users/simon/.julia/v0.3/DataFrames/src/statsmodels/formula.jl:238
 in fit at /Users/simon/.julia/v0.3/DataFrames/src/statsmodels/statsmodel.jl:52
 in lm at /Users/simon/.julia/v0.3/GLM/src/lm.jl:43

Evidently not an IJulia issue. Probably related to JuliaLang/julia#8631

@tcfuji
Copy link
Author

tcfuji commented Oct 25, 2014

You're right. Sorry for the trouble.

@tcfuji tcfuji closed this as completed Oct 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants