Machine Box Classificationbox Client Library in Clojure
cljassify is a simple, thin client for interacting with Classificationbox. It follows the API quite closely, and uses some sane defaults to make it easy to interact with Classificationbox at the repl or write simple tools but is complete enough to use for actual applications.
Lein/Boot
[cljassify "0.1.0-SNAPSHOT"]
Clojure CLI/deps.edn
cljassify {:mvn/version "0.1.0-SNAPSHOT"}
Maven
<dependency>
<groupId>cljassify</groupId>
<artifactId>cljassify</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
Still a work in progress.
;; define a model ...
(def my-model (model ["class1" "class2"]))
;; ... and create it
(create-model my-model)
;; => {:classes ["class1" "class2"]
;; :id "1722034485-i"
;; :name "1722034485-n"
;; :options {}
;; :success true}
;; create an example to teach the model
(def example {:class "class1", :inputs [{:key "user_age", :type "number", :value "32"}]})
(teach-model (:id my-model) example)
;; => {:success true}
;; now lets see if we get a prediction.
(def features {:limit 10 :inputs [{:key "user_age" :type "number" :value "32"}]})
(predict (:id my-model) features)
;; => {:classes [{:id "class1" :score 0.60721} {:id "class2" :score 0.39279}]
;; :success true}
See the uberdoc.
Copyright © 2018 josh rotenberg
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.