is-early: 3:30 -> 7:00
is-late: 10:30 -> 3:30
-- learn this: is-early |time: 24h: *> #=> do-you-know drop-above[700] drop-below[330] pop-float |_self> is-late |time: 24h: *> #=> do-you-know (drop-below[2230] pop-float |_self> + drop-above[330] pop-float |_self>) -- now test it: -- learn a list of times: |24h times> => range(|time: 24h: 100>,|time: 24h: 2400>,|100>) -- pretty print a table: sa: table[24h-time,is-early,is-late] "" |24h times>
+-----------------+----------+---------+ | 24h-time | is-early | is-late | +-----------------+----------+---------+ | time: 24h: 100 | no | yes | | time: 24h: 200 | no | yes | | time: 24h: 300 | no | yes | | time: 24h: 400 | yes | no | | time: 24h: 500 | yes | no | | time: 24h: 600 | yes | no | | time: 24h: 700 | yes | no | | time: 24h: 800 | no | no | | time: 24h: 900 | no | no | | time: 24h: 1000 | no | no | | time: 24h: 1100 | no | no | | time: 24h: 1200 | no | no | | time: 24h: 1300 | no | no | | time: 24h: 1400 | no | no | | time: 24h: 1500 | no | no | | time: 24h: 1600 | no | no | | time: 24h: 1700 | no | no | | time: 24h: 1800 | no | no | | time: 24h: 1900 | no | no | | time: 24h: 2000 | no | no | | time: 24h: 2100 | no | no | | time: 24h: 2200 | no | no | | time: 24h: 2300 | no | yes | | time: 24h: 2400 | no | yes | +-----------------+----------+---------+So, that works and all. I guess a thing to note is we can rewrite our learn rules using the in-range sigmoid and the drop function, instead of drop-above and drop-below. Simply enough:
range-is-early |time: 24h: *> #=> do-you-know drop sigmoid-in-range[330,700] pop-float |_self> range-is-late |time: 24h: *> #=> do-you-know drop (sigmoid-in-range[2230,2400] pop-float |_self> + sigmoid-in-range[0,330] pop-float |_self>) -- now look at the resulting table: -- (we see they essentially agree) sa: table[24h-time,is-early,range-is-early,is-late,range-is-late] "" |24h times> +-----------------+----------+----------------+---------+---------------+ | 24h-time | is-early | range-is-early | is-late | range-is-late | +-----------------+----------+----------------+---------+---------------+ | time: 24h: 100 | no | no | yes | yes | | time: 24h: 200 | no | no | yes | yes | | time: 24h: 300 | no | no | yes | yes | | time: 24h: 400 | yes | yes | no | no | | time: 24h: 500 | yes | yes | no | no | | time: 24h: 600 | yes | yes | no | no | | time: 24h: 700 | yes | yes | no | no | | time: 24h: 800 | no | no | no | no | | time: 24h: 900 | no | no | no | no | | time: 24h: 1000 | no | no | no | no | | time: 24h: 1100 | no | no | no | no | | time: 24h: 1200 | no | no | no | no | | time: 24h: 1300 | no | no | no | no | | time: 24h: 1400 | no | no | no | no | | time: 24h: 1500 | no | no | no | no | | time: 24h: 1600 | no | no | no | no | | time: 24h: 1700 | no | no | no | no | | time: 24h: 1800 | no | no | no | no | | time: 24h: 1900 | no | no | no | no | | time: 24h: 2000 | no | no | no | no | | time: 24h: 2100 | no | no | no | no | | time: 24h: 2200 | no | no | no | no | | time: 24h: 2300 | no | no | yes | yes | | time: 24h: 2400 | no | no | yes | yes | +-----------------+----------+----------------+---------+---------------+That's probably it for today. Heaps more to come, as usual. Though maybe I should make the observation if I had a better parser, we could compact the range-is-late operator a little to this:
range-is-late |time: 24h: *> #=> do-you-know drop (sigmoid-in-range[2230,2400] + sigmoid-in-range[0,330]) pop-float |_self>
No comments:
Post a Comment