cs 10 problem solving via object oriented programming
play

CS 10: Problem solving via Object Oriented Programming - PowerPoint PPT Presentation

CS 10: Problem solving via Object Oriented Programming Winter 2017 Tim Pierson 260 (255) Sudikoff Day 20 PaGern RecogniIon Agenda 1. PaGern


  1. CS ¡10: ¡ Problem ¡solving ¡via ¡Object ¡Oriented ¡ Programming ¡ Winter ¡2017 ¡ ¡ Tim ¡Pierson ¡ 260 ¡(255) ¡Sudikoff ¡ Day ¡20 ¡– ¡PaGern ¡RecogniIon ¡

  2. Agenda ¡ 1. PaGern ¡matching ¡vs. ¡recogniIon ¡ 2. From ¡Finite ¡Automata ¡to ¡Hidden ¡ Markov ¡Models ¡ 3. Decoding: ¡Viterbi ¡algorithm ¡ 4. Training ¡ 2 ¡

  3. Last ¡class ¡we ¡discussed ¡how ¡to ¡use ¡a ¡Finite ¡ Automata ¡to ¡match ¡a ¡paGern ¡ Email ¡addresses ¡follow ¡a ¡paGern: ¡ ¡ mailbox@domain.TLD ¡ ¡ ¡ example: ¡tjp@cs.dartmouth.edu ¡ com ¡ ¡ Start ¡ ¡ . ¡ a-­‑z ¡ @ ¡ a-­‑z ¡ ¡ edu ¡ ¡ a-­‑z ¡ a-­‑z ¡ ¡ ¡ org ¡ Finite ¡Automata ¡can ¡represent ¡email ¡address ¡paGern ¡ Sample ¡addresses ¡can ¡be ¡easily ¡verified ¡if ¡in ¡correct ¡form ¡ . ¡ The ¡email ¡address ¡paGern ¡must ¡be ¡followed ¡ exactly ¡ . ¡ Any ¡deviaIon ¡results ¡in ¡rejecIon ¡ . ¡ 3 ¡

  4. SomeImes ¡our ¡input ¡is ¡noisy ¡and ¡does ¡not ¡ exactly ¡match ¡a ¡paGern ¡ Pa%ern ¡matching ¡vs. ¡recogni2on ¡ Matching ¡ Recogni2on ¡ Is ¡this ¡a ¡duck? ¡ 4 ¡ Image: ¡duckrace.com ¡

  5. SomeImes ¡our ¡input ¡is ¡noisy ¡and ¡does ¡not ¡ exactly ¡match ¡a ¡paGern ¡ Pa%ern ¡matching ¡vs. ¡recogni2on ¡ Matching ¡ Recogni2on ¡ Looks ¡like ¡a ¡ duck ¡ Is ¡this ¡a ¡duck? ¡ 5 ¡ Image: ¡duckrace.com ¡

  6. SomeImes ¡our ¡input ¡is ¡noisy ¡and ¡does ¡not ¡ exactly ¡match ¡a ¡paGern ¡ Pa%ern ¡matching ¡vs. ¡recogni2on ¡ Matching ¡ Recogni2on ¡ Looks ¡like ¡a ¡ duck ¡ Quacks ¡like ¡ a ¡duck ¡ Is ¡this ¡a ¡duck? ¡ 6 ¡ Image: ¡duckrace.com ¡

  7. SomeImes ¡our ¡input ¡is ¡noisy ¡and ¡does ¡not ¡ exactly ¡match ¡a ¡paGern ¡ Pa%ern ¡matching ¡vs. ¡recogni2on ¡ Matching ¡ Recogni2on ¡ Looks ¡like ¡a ¡ duck ¡ Quacks ¡like ¡ a ¡duck ¡ Does ¡not ¡ wear ¡cool ¡ Is ¡this ¡a ¡duck? ¡ eyewear ¡ 7 ¡ Image: ¡duckrace.com ¡

  8. SomeImes ¡our ¡input ¡is ¡noisy ¡and ¡does ¡not ¡ exactly ¡match ¡a ¡paGern ¡ Pa%ern ¡matching ¡vs. ¡recogni2on ¡ Matching ¡ Recogni2on ¡ Looks ¡like ¡a ¡ duck ¡ Quacks ¡like ¡ a ¡duck ¡ Does ¡not ¡ wear ¡cool ¡ Is ¡this ¡a ¡duck? ¡ eyewear ¡ Is ¡it ¡a ¡duck? ¡ ¡ 8 ¡ Image: ¡duckrace.com ¡

  9. Agenda ¡ 1. PaGern ¡matching ¡vs. ¡recogniIon ¡ 2. From ¡Finite ¡Automata ¡to ¡Hidden ¡ Markov ¡Models ¡ 3. Decoding: ¡Viterbi ¡algorithm ¡ 4. Training ¡ 9 ¡

  10. We ¡can ¡model ¡systems ¡using ¡Finite ¡ Automata ¡ Weather ¡model: ¡possible ¡states ¡ The ¡ State ¡of ¡the ¡ weather ¡can ¡be: ¡ • Sunny ¡ Sunny ¡ Cloudy ¡ • Cloudy ¡ • Rainy ¡ Rainy ¡ 10 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  11. We ¡can ¡model ¡systems ¡using ¡Finite ¡ Automata ¡ Weather ¡model: ¡transi2ons ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ We ¡can ¡observe ¡ weather ¡paGerns ¡and ¡ 0.2 ¡ determine ¡probability ¡ Sunny ¡ Cloudy ¡ of ¡ transi2on ¡between ¡ states ¡ 0.2 ¡ 0.2 ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 11 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  12. We ¡can ¡model ¡systems ¡using ¡Finite ¡ Automata ¡ Weather ¡model: ¡Sunny ¡day ¡example ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ Probability ¡a ¡sunny ¡day ¡is ¡ followed ¡by: ¡ 0.2 ¡ Sunny ¡ Cloudy ¡ 0.2 ¡ 0.2 ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 12 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  13. We ¡can ¡model ¡systems ¡using ¡Finite ¡ Automata ¡ Weather ¡model: ¡Sunny ¡day ¡example ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ Probability ¡a ¡sunny ¡day ¡is ¡ followed ¡by: ¡ 0.2 ¡ • Another ¡sunny ¡day ¡80% ¡ Sunny ¡ Cloudy ¡ 0.2 ¡ 0.2 ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 13 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  14. We ¡can ¡model ¡systems ¡using ¡Finite ¡ Automata ¡ Weather ¡model: ¡Sunny ¡day ¡example ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ Probability ¡a ¡sunny ¡day ¡is ¡ followed ¡by: ¡ 0.2 ¡ • Another ¡sunny ¡day ¡80% ¡ Sunny ¡ Cloudy ¡ • A ¡cloudy ¡day ¡15% ¡ 0.2 ¡ 0.2 ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 14 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  15. We ¡can ¡model ¡systems ¡using ¡Finite ¡ Automata ¡ Weather ¡model: ¡Sunny ¡day ¡example ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ Probability ¡a ¡sunny ¡day ¡is ¡ followed ¡by: ¡ 0.2 ¡ • Another ¡sunny ¡day ¡80% ¡ Sunny ¡ Cloudy ¡ • A ¡cloudy ¡day ¡15% ¡ • A ¡rainy ¡day ¡5% ¡ 0.2 ¡ 0.2 ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 15 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  16. Model ¡allows ¡us ¡to ¡answer ¡quesIons ¡about ¡ the ¡probability ¡of ¡events ¡occurring ¡ Weather ¡model: ¡predict ¡two ¡days ¡in ¡advance ¡ Given ¡today ¡is ¡sunny, ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ what ¡is ¡the ¡probability ¡it ¡ will ¡be ¡rainy ¡two ¡days ¡ from ¡now? ¡ 0.2 ¡ Sunny ¡ Cloudy ¡ ¡ 0.2 ¡ 0.2 ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 16 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  17. FA ¡model ¡allows ¡us ¡to ¡answer ¡quesIons ¡ about ¡the ¡probability ¡of ¡events ¡occurring ¡ Weather ¡model: ¡predict ¡two ¡days ¡in ¡advance ¡ Given ¡today ¡is ¡sunny, ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ what ¡is ¡the ¡probability ¡it ¡ will ¡be ¡rainy ¡two ¡days ¡ from ¡now? ¡ 0.2 ¡ Sunny ¡ Cloudy ¡ • Could ¡be ¡sunny, ¡then ¡ rainy ¡ 0.2 ¡ 0.2 ¡ ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 17 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  18. FA ¡model ¡allows ¡us ¡to ¡answer ¡quesIons ¡ about ¡the ¡probability ¡of ¡events ¡occurring ¡ Weather ¡model: ¡predict ¡two ¡days ¡in ¡advance ¡ Given ¡today ¡is ¡sunny, ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ what ¡is ¡the ¡probability ¡it ¡ will ¡be ¡rainy ¡two ¡days ¡ from ¡now? ¡ 0.2 ¡ Sunny ¡ Cloudy ¡ • Could ¡be ¡sunny, ¡then ¡ rainy ¡ 0.2 ¡ 0.2 ¡ ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 18 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  19. FA ¡model ¡allows ¡us ¡to ¡answer ¡quesIons ¡ about ¡the ¡probability ¡of ¡events ¡occurring ¡ Weather ¡model: ¡predict ¡two ¡days ¡in ¡advance ¡ Given ¡today ¡is ¡sunny, ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ what ¡is ¡the ¡probability ¡it ¡ will ¡be ¡rainy ¡two ¡days ¡ from ¡now? ¡ 0.2 ¡ Sunny ¡ Cloudy ¡ • Could ¡be ¡sunny, ¡then ¡ rainy ¡(0.8*0.05) ¡ 0.2 ¡ 0.2 ¡ ¡ 0.05 ¡ 0.3 ¡ Rainy ¡ 0.6 ¡ 19 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

  20. FA ¡model ¡allows ¡us ¡to ¡answer ¡quesIons ¡ about ¡the ¡probability ¡of ¡events ¡occurring ¡ Weather ¡model: ¡predict ¡two ¡days ¡in ¡advance ¡ Given ¡today ¡is ¡sunny, ¡ 0.8 ¡ 0.15 ¡ 0.5 ¡ what ¡is ¡the ¡probability ¡it ¡ will ¡be ¡rainy ¡two ¡days ¡ from ¡now? ¡ 0.2 ¡ Sunny ¡ Cloudy ¡ • Could ¡be ¡sunny, ¡then ¡ rainy ¡(0.8*0.05) ¡ 0.2 ¡ 0.2 ¡ • Could ¡be ¡cloudy, ¡then ¡ rainy ¡ 0.05 ¡ 0.3 ¡ ¡ Rainy ¡ 0.6 ¡ 20 ¡ Adapted ¡from: ¡hGps://pdfs.semanIcscholar.org/b328/2eb0509442b80760fea5845e158168daee62.pdf ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend