Skip to content

Commit

Permalink
added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daslu committed Sep 18, 2024
1 parent 77f5618 commit 592b953
Show file tree
Hide file tree
Showing 2 changed files with 494 additions and 1 deletion.
9 changes: 8 additions & 1 deletion notebooks/noj_book/automl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

(ns noj-book.automl
(:require [noj-book.ml-basic :as ml-basic]
[scicloj.kindly.v4.kind :as kind]))
[scicloj.kindly.v4.kind :as kind]
[tablecloth.api :as tc]
[scicloj.kindly.v4.api :as kindly]))

;; ## The metamorph pipeline abstraction
;; When doing automl, it is very useful to be able to manage
Expand Down Expand Up @@ -368,6 +370,11 @@ train-ctx
(tc/head)
(kind/table))

(kindly/check
#(-> %
tc/rows
(= [[[:sex :pclass :embarked] 0.8110772551260077 {:model-type :scicloj.ml.tribuo/classification, :tribuo-components [{:name "random-forest", :type "org.tribuo.classification.dtree.CARTClassificationTrainer", :properties {:maxDepth "8", :useRandomSplitPoints "false", :fractionFeaturesInSplit "0.5"}}], :tribuo-trainer-name "random-forest"}] [[:sex] 0.7863327620135847 {:model-type :scicloj.ml.tribuo/classification, :tribuo-components [{:name "random-forest", :type "org.tribuo.classification.dtree.CARTClassificationTrainer", :properties {:maxDepth "8", :useRandomSplitPoints "false", :fractionFeaturesInSplit "0.5"}}], :tribuo-trainer-name "random-forest"}] [[:sex :pclass] 0.7863327620135847 {:model-type :scicloj.ml.tribuo/classification, :tribuo-components [{:name "logistic", :type "org.tribuo.classification.sgd.linear.LinearSGDTrainer"}], :tribuo-trainer-name "logistic"}] [[:sex :embarked] 0.7863327620135847 {:model-type :scicloj.ml.tribuo/classification, :tribuo-components [{:name "logistic", :type "org.tribuo.classification.sgd.linear.LinearSGDTrainer"}], :tribuo-trainer-name "logistic"}] [[:sex] 0.7863327620135847 {:model-type :scicloj.ml.tribuo/classification, :tribuo-components [{:name "logistic", :type "org.tribuo.classification.sgd.linear.LinearSGDTrainer"}], :tribuo-trainer-name "logistic"}]])))

;; ## Best practices for data transformation steps in or outside pipeline
;;
(require '[scicloj.metamorph.ml.toydata :as data]
Expand Down
Loading

0 comments on commit 592b953

Please sign in to comment.