type hints
This commit is contained in:
parent
81cda11ed2
commit
5d59785f3b
1 changed files with 8 additions and 8 deletions
|
@ -231,14 +231,13 @@
|
||||||
(defn dataset-nominal?
|
(defn dataset-nominal?
|
||||||
"Returns boolean indicating if the class attribute is nominal"
|
"Returns boolean indicating if the class attribute is nominal"
|
||||||
[^Instances dataset]
|
[^Instances dataset]
|
||||||
(let [^Attribute class-attr (.classAttribute dataset)]
|
(.. dataset classAttribute isNominal))
|
||||||
(.isNominal class-attr)))
|
|
||||||
|
|
||||||
(defn dataset-class-values
|
(defn dataset-class-values
|
||||||
"Returns a lazy-seq of the values for the dataset's class attribute.
|
"Returns a lazy-seq of the values for the dataset's class attribute.
|
||||||
If the class is nominal then the string value (not keyword) is returned."
|
If the class is nominal then the string value (not keyword) is returned."
|
||||||
[^Instances dataset]
|
[^Instances dataset]
|
||||||
(let [^Attribute class-attr (.classAttribute dataset)
|
(let [class-attr (.classAttribute dataset)
|
||||||
class-value (if (.isNominal class-attr)
|
class-value (if (.isNominal class-attr)
|
||||||
(fn [^Instance i] (.stringValue i class-attr))
|
(fn [^Instance i] (.stringValue i class-attr))
|
||||||
(fn [^Instance i] (.classValue i)))] ;classValue returns the double
|
(fn [^Instance i] (.classValue i)))] ;classValue returns the double
|
||||||
|
@ -248,18 +247,19 @@ If the class is nominal then the string value (not keyword) is returned."
|
||||||
|
|
||||||
(defn instance-set-class
|
(defn instance-set-class
|
||||||
"Sets the index of the class attribute for this instance"
|
"Sets the index of the class attribute for this instance"
|
||||||
[instance pos]
|
[^Instance instance pos]
|
||||||
(doto instance (.setClassValue pos)))
|
(doto instance (.setClassValue (int pos))))
|
||||||
|
|
||||||
(defn instance-get-class
|
(defn instance-get-class
|
||||||
"Get the index of the class attribute for this instance"
|
"Get the index of the class attribute for this instance"
|
||||||
[instance]
|
[^Instance instance]
|
||||||
(.classValue instance))
|
(.classValue instance))
|
||||||
|
|
||||||
(defn instance-value-at
|
(defn instance-value-at
|
||||||
"Returns the value of an instance attribute"
|
"Returns the value of an instance attribute"
|
||||||
[^Instance instance pos]
|
[^Instance instance pos]
|
||||||
(let [attr (.attribute instance pos)]
|
(let [pos (int pos)
|
||||||
|
attr (.attribute instance pos)]
|
||||||
(if (.isNominal attr)
|
(if (.isNominal attr)
|
||||||
(keyword (.stringValue instance pos))
|
(keyword (.stringValue instance pos))
|
||||||
(.value instance pos))))
|
(.value instance pos))))
|
||||||
|
@ -291,7 +291,7 @@ If the class is nominal then the string value (not keyword) is returned."
|
||||||
(if (= (class dataset)
|
(if (= (class dataset)
|
||||||
ClojureInstances)
|
ClojureInstances)
|
||||||
(seq dataset)
|
(seq dataset)
|
||||||
(seq (new ClojureInstances dataset))))
|
(seq (new ClojureInstances ^Instances dataset))))
|
||||||
|
|
||||||
(defn dataset-as-maps
|
(defn dataset-as-maps
|
||||||
"Returns a lazy sequence of the dataset represetned as maps.
|
"Returns a lazy sequence of the dataset represetned as maps.
|
||||||
|
|
Loading…
Reference in a new issue