joshrotenberg / cljassify

A Clojure Client/DSL for the Machine Box Classificationbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cljassify

Machine Box Classificationbox Client Library in Clojure

CircleCI Dependencies Status cljdoc badge

Clojars Project

Overview

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.

Installation

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>

Status

Still a work in progress.

Usage

Client

;; 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}

Docs

See the uberdoc.

License

Copyright © 2018 josh rotenberg

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

A Clojure Client/DSL for the Machine Box Classificationbox

License:Eclipse Public License 1.0


Languages

Language:Clojure 100.0%