From 4a5885bca110d292852fb58b86b049fe99af5c66 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 25 Oct 2012 18:15:56 -0700 Subject: [PATCH] machine-learning.one-hot: Use the example from my blog post as a unit test. --- .../one-hot/one-hot-tests.factor | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/extra/machine-learning/one-hot/one-hot-tests.factor b/extra/machine-learning/one-hot/one-hot-tests.factor index e8c09c4006..0343683060 100644 --- a/extra/machine-learning/one-hot/one-hot-tests.factor +++ b/extra/machine-learning/one-hot/one-hot-tests.factor @@ -4,10 +4,16 @@ USING: tools.test machine-learning.one-hot ; IN: machine-learning.one-hot.tests CONSTANT: test-data { - { "male" "female" } - { "from Europe" "from US" "from Asia" } - { "uses Firefox" "uses Chrome" "uses Safari" "uses Internet Explorer" } + { "hot" "cold" } + { "cloudy" "raining" "snowing" "sunny" } + { "light" "heavy" } + { "bright-colored" "dark-colored" "neutral" } + { "quickly" "slowly" } + { "well" "sick" "tired" } } -{ { 1 0 0 1 0 0 0 0 1 } } -[ { 0 1 3 } test-data one-hot ] unit-test +{ { 1 0 0 0 0 1 1 0 0 0 1 0 1 1 0 0 } } +[ { 0 3 0 2 1 0 } test-data one-hot ] unit-test + +{ { 0 1 0 0 1 0 0 1 0 1 0 1 0 0 1 0 } } +[ { 1 2 1 1 0 1 } test-data one-hot ] unit-test