kimim / clj-djl-examples

Examples with clj-djl
Eclipse Public License 2.0
4 stars 1 forks source link

Incorrect parameter for ds/random-split #2

Closed chamaeleon closed 3 years ago

chamaeleon commented 3 years ago

mushrooms.clj has the code

(let [[mushroom-train mushroom-test] (ds/random-split dataset [70 30])
  ...)

However, ds/random-split is currently defined as

(defn random-split
  [dataset & ratios]
  (.randomSplit dataset (int-array ratios)))

which means ratios becomes a list containing one element, the array [70 30], instead of a list containing 70 and 30. Either the mushrooms.clj code need to be updated to be

(let [[mushroom-train mushroom-test] (ds/random-split dataset 70 30)
  ...)

or the ampersand needs to be removed from the random-split definition.

I would assume the former (changing the call in mushrooms.clj) is preferable since it is an example, and not an API function that may be in use by other people.

kimim commented 3 years ago

Yes, I was thinking using vector is more clojure-style, but at last plain number list style is decided.