How to change a element in the matrix? According to Incanter document, the library is built on top of Clatrix. With Clatrix, set an element in the matrix with the command (set A 1 2 0)
. Please comment how to set the element in incanter. Thank you.
(ns cljsl.optimization
(:require [incanter.core :as i]
[incanter.stats :as s]))
;; create a matrix
cljsl.examples=> (def A (i/matrix [[0 1 2] [3 4 5]]))
cljsl.examples=> A
A 2x3 matrix
-------------
0.00e+00 1.00e+00 2.00e+00
3.00e+00 4.00e+00 5.00e+00
;; the view the item
cljsl.examples=> (i/$ 0 0 A)
0.0
;; element can be set with Clatrix, unfortunately, it don't correct with Incanter.
cljsl.examples=> (cl/set A 1 2 0)
Thanks for the help. After review the book
Clojure for Machine Learning
andClojure for Data Science
. Found procedures to fix the error.adding the following dependency to the
project.clj
file.The namespace declaration
Testing