Coding Challenge #42: Markov Chains - Part 1

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=eGFJ8vugIWA



Duration: 26:41
75,690 views
1,405


In this multi-part coding challenge I attempt to use a Markov Chain to generate a new name for my YouTube channel. Code: https://thecodingtrain.com/challenges/42-markov-chain-name-generator

p5.js Web Editor Sketches:
πŸ•ΉοΈ Markov Chain Text: https://editor.p5js.org/codingtrain/sketches/Y6SvoMcyH
πŸ•ΉοΈ Markov Chain Name Generator: https://editor.p5js.org/codingtrain/sketches/AAgqWiJAW

Other Parts of this Challenge:
πŸ“Ί Markov Chain Name Generator: https://youtu.be/9r8CmofnbAQ

πŸŽ₯ Previous video: https://youtu.be/aKiyCeIuwn4?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Next video: https://youtu.be/8Z9FRiW2Jlc?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
πŸ”— Google Ngram Viewer: https://books.google.com/ngrams
πŸ”— n-gram on Wikipedia: https://en.wikipedia.org/wiki/N-gram
πŸ”— Web Trigrams: http://www.chrisharrison.net/index.php/Visualizations/WebTrigrams
πŸ”— Generative Course Descriptions: http://static.decontextualize.com/toys/next_semester?
πŸ”— King James Programming: http://kingjamesprogramming.tumblr.com/
πŸ”— Markov Chains Explained: http://setosa.io/ev/markov-chains/
πŸ”— Perlin Noise song: https://soundcloud.com/fl00per/perlin-noise

Live Stream Archive:
πŸ”΄ Coding Train Live 64: https://youtu.be/4DR0ryGSYJQ?t=2423s

Related Coding Challenges:
πŸš‚ #37 Diastic Machine: https://youtu.be/u-HUtrpyi1c
πŸš‚ #39 Mad Libs Generator: https://youtu.be/ziBO-U2_t3k

Timestamps:
0:00 Introduce the coding challenge
0:28 Reference article explaining Markov chains
0:43 Explain the logic of Markov chains
2:39 Mention possible use cases
3:06 Describe the scope of the coding challenge
4:58 Explain n-grams and n-grams order
6:58 Set up p5.js sketch with a string of text
7:19 Create an array with all possible tri-grams
9:55 Explain the data structure to study n-grams
11:05 Create an object of unique tri-grams
12:12 Experiment with a different string of text
13:15 Consider the character after each tri-gram
14:30 Examine the output object
16:30 Expand sketch to generate text on demand
18:10 Consider n-grams for an arbitrary string of text
18:53 Pick a random element from one of the n-grams characters
20:00 Repeat the process to create longer strings
21:07 Create n-grams from the current result
22:05 Highlight output text
22:20 Test with different input text
23:02 Test with different arguments
23:14 Debug n-gram logic
24:47 Explain the influence of the order value
25:35 Conclude the coding challenge

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

πŸš‚ Website: http://thecodingtrain.com/
πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: https://github.com/CodingTrain
πŸ’¬ Discord: https://thecodingtrain.com/discord
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: https://standard.tv/codingtrain
πŸ–‹οΈ Twitter: https://twitter.com/thecodingtrain
πŸ“Έ Instagram: https://www.instagram.com/the.coding.train/

πŸŽ₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— p5.js: https://p5js.org
πŸ”— p5.js Web Editor: https://editor.p5js.org/
πŸ”— Processing: https://processing.org

πŸ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new

#markovchain #ngram #textgenerator #javascript #p5js







Tags:
live
programming
daniel shiffman
creative coding
p5.js
coding challenge
p5.js tutorial
p5js
javascript (programming language)
tutorial
javascript
algorithms
javascript string object
js string object
programming from a to z
programming challenge
regular expressions
text analysis
markov chains
ngrams
ngram
n-gram
n-grams
markov chain
markov text generator
markov chain algorithm