Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Domo Arigato, Mr. Roboto: Machine Learning with Ruby
Eric Weinstein
November 10, 2016
Technology
1
860
Domo Arigato, Mr. Roboto: Machine Learning with Ruby
Slides for my RubyConf 2016 talk on machine learning.
Eric Weinstein
November 10, 2016
Tweet
Share
More Decks by Eric Weinstein
See All by Eric Weinstein
Interview Them Where They Are
ericqweinstein
0
77
Value Your Types!
ericqweinstein
0
50
Being Good: An Introduction to Robo- and Machine Ethics
ericqweinstein
1
1.3k
What If...?: Ruby 3
ericqweinstein
1
160
Infinite State Machine
ericqweinstein
1
74
Do Androids Dream of Electronic Dance Music?
ericqweinstein
1
50
Machine Learning with Elixir and Phoenix
ericqweinstein
1
760
Machine Learning with Clojure and Apache Spark
ericqweinstein
1
300
A Nil Device, A Lonely Operator, and a Voyage to the Void Star
ericqweinstein
1
540
Other Decks in Technology
See All in Technology
Poolにおける足を止めないシステム基盤構築
winebarrel
3
540
Learning from AWS Customer Security Incidents [2022]
ramimac
0
220
The Real MVP: Going from idea to users' hands
adavis
0
520
HTTP Session Architecture Pattern
chiroito
1
320
Power Query 日時の変換でちょっと焦ったケース +1 / Power Query Some cases
ishiayaya
0
140
如何使用 Argo Event& Workflow 快速建置自定義的工作流程 @ #CNTUG #47
line_developers_tw
PRO
0
320
SRE_チーム立ち上げから1年_気づいたら_SRE_っぽくない仕事まで貢献しちゃってる説
bitkey
PRO
0
1.3k
Power BIのモバイルと都 +1 / Tokyo
ishiayaya
0
130
TypeScript 4.7と型レベルプログラミング
uhyo
5
2.5k
ZOZOTOWNのProduction Readiness Checklistと信頼性向上の取り組み / Improvement the reliability of ZOZOTOWN with Production Readiness Checklist
akitok_
4
1.2k
エンジニアインターンの採用〜実際の開発への関与について for EM meetup#10
dmiyamoto
1
250
Okta Identity Engineってどうよ?
tatsumin39
0
270
Featured
See All Featured
Faster Mobile Websites
deanohume
294
28k
How STYLIGHT went responsive
nonsquared
85
3.9k
Optimizing for Happiness
mojombo
365
63k
Mobile First: as difficult as doing things right
swwweet
212
7.5k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
Streamline your AJAX requests with AmplifyJS and jQuery
dougneiner
125
8.5k
The Invisible Customer
myddelton
110
11k
It's Worth the Effort
3n
172
25k
Designing with Data
zakiwarfel
91
3.8k
The Brand Is Dead. Long Live the Brand.
mthomps
45
2.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
3
420
From Idea to $5000 a Month in 5 Months
shpigford
372
44k
Transcript
Dōmo arigatō, Mr. Roboto: Machine Learning with Ruby # Eric
Weinstein # RubyConf 2016 # Cincinnati, Ohio # 10 November 2016
for Joshua
Part 0: Hello!
About Me eric_weinstein = { employer: 'Hulu', github: 'ericqweinstein', twitter:
'ericqweinstein', website: 'ericweinste.in' } 30% off with RUBYCONF30!
Agenda • What is machine learning? • What is supervised
learning? • What’s a neural network? • Machine learning with Ruby and the MNIST dataset
Part 1: Machine Learning
None
What’s machine learning?
In a word:
Generalization
What’s Supervised Learning? Classification or regression, generalizing from labeled data
to unlabeled data
Features && Labels • Raw pixel features (vectors of intensities)
• Digit (0..9)
Features && Labels • Raw pixel features (vectors of intensities)
• Digit (0..9)
Image credit: https://www.tensorflow.org/versions/r0.9/tutorials/mnist/ beginners/index.html
What’s a neural network?
Image credit: https://github.com/cdipaolo/goml/tree/master/perceptron
Image credit: https://en.wikipedia.org/wiki/Artificial_neural_network
Part 2: The MNIST Dataset
Our Data • Images of handwritten digits, size-normalized and centered
• Training: 60,000 examples, test: 10,000 • http://yann.lecun.com/exdb/mnist/
Image credit: https://www.researchgate.net/
How’d We Do? • Correct: 9328 / 10_000 • Incorrect:
672 / 10_000 • Overall: 93.28% accuracy
Developing the App
Front End submit() { fetch('/submit', { method: 'POST', body: this.state.canvas.toDataURL('image/png')
}).then(response => { return response.json(); }).then(j => { this.setState({ prediction: j.prediction }); }); }
Front End render() { return( <div> <EditableCanvas canvas={this.state.canvas} ctx={this.state.ctx} ref='editableCanvas'
/> <Prediction number={this.state.prediction} /> <div> <Button onClick={this.submit} value='Submit' /> <Button onClick={this.clear} value='Clear' /> </div> </div> ); }
Back End train = RubyFann::TrainData.new(inputs: features, desired_outputs: labels) fann =
RubyFann::Standard.new(num_inputs: 576, hidden_neurons: [300], num_outputs: 10) fann.train_on_data(train, 1000, 10, 0.01)
STOP #demotime
Summary • Machine learning is generalization • Supervised learning is
labeled data -> unlabeled data • Neural networks are awesome • You can do all this with Ruby!
Takeaways (TL;DPA) • We can do machine learning with Ruby
• Contribute to tools like Ruby FANN (github.com/tangledpath/ruby-fann) and sciruby (http://sciruby.com/) • Check it out: http://ruby-mnist.herokuapp.com/ • PRs welcome! github.com/ericqweinstein/ruby- mnist
Thank You!
Questions? eric_weinstein = { employer: 'Hulu', github: 'ericqweinstein', twitter: 'ericqweinstein',
website: 'ericweinste.in' } 30% off with RUBYCONF30!