Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Problems with linear model in Incanter 1.9.2 #390

@Goldritter

Description

@Goldritter

Hello,
I try to use the linear model in Incanter 1.9.2 but I get always the error, that "something" cannot be cast into a Number.

Here the example codes I try to use (one is an example from https://github.com/hamishdickson/clojure-machine-learning/blob/master/src/clojure_machine_learning/linear-regression/linear-regression.clj) :

(def X (cl/matrix [8.401 14.475 13.396 12.127 5.044
8.339 15.692 17.108 9.253 12.029]))

(def Y (cl/vector [-1.57 2.32 0.424 0.814 -2.3 0.01
1.954 2.296 -0.635 0.328]))
=> #'export.esicm.export/X
=> #'export.esicm.export/Y
(INCANTER-STATS/linear-model Y X)
ClassCastException clatrix.core.Vector cannot be cast to java.lang.Number clojure.lang.Numbers.minus (Numbers.java:137)

(INCANTER-STATS/linear-model [1 2 3] [1 2 3])
ClassCastException mikera.vectorz.Scalar cannot be cast to java.lang.Number clojure.lang.Numbers.minus (Numbers.java:137)

I use Clojure 1.8.0 and have following dependencies:

;; Math dependencies
[org.clojure/math.numeric-tower "0.0.4"]
[org.clojure/data.priority-map "0.0.5"]
[org.clojure/math.combinatorics "0.1.4"]
[net.mikera/core.matrix "0.60.3"]
[clatrix "0.3.0"]
[net.mikera/vectorz-clj "0.47.0"]
[distributions "0.1.2"]

;; Statistical dependencies
[incanter/incanter-core "1.9.2"]
[incanter/incanter-charts "1.9.2"]
[incanter/incanter-excel "1.9.2"]

With best regards

Marcus

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions