-
-
Save ashenfad/31f1055d81f0432d305232fd71c19f6b to your computer and use it in GitHub Desktop.
Convert a 2d collection into an anomaly detector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns detector | |
(:require (bigml.api [core :as api] | |
[source :as source] | |
[dataset :as dataset] | |
[anomaly-detector :as anomaly-detector] | |
[anomaly-score :as anomaly-score]) | |
(clojure.data [csv :as csv]))) | |
(defn data->detector [data] | |
(-> (source/create data) | |
(api/get-final) | |
(dataset/create) | |
(api/get-final) | |
(anomaly-detector/create :forest_size 64) | |
(api/get-final) | |
(anomaly-score/detector))) | |
;; A tiny example... | |
(def my-detector | |
(-> (slurp "https://goo.gl/79KsJ4") | |
(csv/read-csv) | |
(data->detector))) | |
(println (my-detector [0.5 0.45 0.4 0.44 0.01])) | |
;; 0.3936344773676654 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment