Clojure: incanter.stats Linear regression model not working

I follow the linear regression example here

(use '(incanter core stats datasets)) (def plant-growth (to-matrix (get-dataset :plant-growth) :dummies true)) (def y (sel plant-growth :cols 0)) (def x (sel plant-growth :cols [1 2])) (def lm (linear-model yx)) 

However, I get this error:

 => (def lm (linear-model yx)) ClassCastException clojure.lang.LazySeq cannot be cast to java.lang.Number clojure.lang.Numbers.lt (Numbers.java:219) 

What's going on here?

Update. This example is also not found from the last 1.4.1 (stable) documents :

 (use '(incanter core stats datasets charts)) (def iris (to-matrix (get-dataset :iris) :dummies true)) (def y (sel iris :cols 0)) (def x (sel iris :cols (range 1 6))) (def iris-lm (linear-model yx)) ; with intercept term 

Output:

 => (def iris-lm (linear-model yx)) ClassCastException clojure.lang.LazySeq cannot be cast to java.lang.Number clojure.lang.Numbers.lt (Numbers.java:219) 

I am using Clojure 1.5.1 and Incanter 1.4.1. Is this a bug that needs to be fixed? Where can I find reputable working examples?

+4
source share
1 answer

According to comments, fixed in Incanter 1.5.0.

0
source

Source: https://habr.com/ru/post/1482865/


All Articles