Makes insights work
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
;; You can also press C-u C-j to evaluate the expression and pretty-print its result.
|
||||
|
||||
(ns build-ml
|
||||
(:require [datomic.client.api :as dc]
|
||||
(:require [datomic.api :as dc]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.data.csv :as csv]
|
||||
[auto-ap.datomic :refer [conn]]))
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
(drop 1)
|
||||
(map (fn [[a n]]
|
||||
[(Long/parseLong a) (numeric-code->account (Long/parseLong n))])))
|
||||
(slurp-csv "/home/notid/dev/transaction-training/input/accounts.csv"))
|
||||
(slurp-csv "/mnt/data/dev2/ml-test/input/accounts.csv"))
|
||||
vendor-name->vendor (into {} (dc/q '[:find ?vn ?v
|
||||
:in $
|
||||
:where [?v :vendor/name ?vn]]
|
||||
@@ -51,18 +51,18 @@
|
||||
(drop 1)
|
||||
(map (fn [[a n]]
|
||||
[(Long/parseLong a) (vendor-name->vendor (Long/parseLong n))])))
|
||||
(slurp-csv "/home/notid/dev/transaction-training/input/vendors.csv"))]
|
||||
inference-vendor->vendor
|
||||
#_(with-open [reader (io/reader "/home/notid/dev/transaction-training/inference-outcome.csv")]
|
||||
(slurp-csv "/mnt/data/dev2/ml-test/input/vendors.csv"))]
|
||||
#_inference-vendor->vendor
|
||||
(with-open [reader (io/reader "/mnt/data/dev2/ml-test/inference-outcome.csv")]
|
||||
(->> (csv/read-csv reader)
|
||||
(into []
|
||||
(comp
|
||||
(drop 1)
|
||||
(map (fn [[_ transaction best-vendor best-account account-confidence]]
|
||||
{:db/id (Long/parseLong transaction)
|
||||
:transaction/recommended-account (Long/parseLong best-account)
|
||||
:transaction/recommended-account (inference-account->account best-account)
|
||||
:transaction/account-confidence (Double/parseDouble account-confidence)
|
||||
:transaction/recommended-vendor (Long/parseLong best-vendor)}))))))))
|
||||
:transaction/recommended-vendor (inference-vendor->vendor best-vendor)}))))))))
|
||||
|
||||
(defn apply-inference [inference]
|
||||
(doseq [p (->> inference (partition-all 100))]
|
||||
|
||||
Reference in New Issue
Block a user