SlideShare a Scribd company logo
Tensorgo?
Using Wistfully looking at
Tensorflow in GO
ME
Background
Test, Test Automation,
Support, Development,
Release Engineering,
Management and now
back to development
with teamwork.com
No Data Science?
Nope. Just someone
who is interested in all
the amazing things
happening in this space
Tensorflow experience
About 7 days… yeah honestly you’ll soon see
Deep Neural Network - In diagram form
Definition
Input Layer - Source of data. No transforms just pass it on
Bias Nodes - Always on. Always set to 1. Think of it as b in y = ax + b. Shifts a
function by allowing flexibility.
Hidden Layer - > 1 layer here makes it a deep network. This is where
calculations are applied and result past to next layer. Hidden because values
not in training set. S
Output Layer - Result from the model. During training this is compared to
expected and used to change weights to improve model
https://ujjwalkarn.me/2016/08/09/quick-intro-neural-networks/
Some good intro resources
https://stevenmiller888.github.io/mind-how-to-build-a-neural-network/
https://www.quora.com/ELI5-What-are-neural-networks is a nice example and talks about how you would get a computer to learn
a ‘square’ function
https://stats.stackexchange.com/questions/63152/what-does-the-hidden-layer-in-a-neural-network-compute
Talks about hidden layers and classifying pictures of a bus. You might look for wheels. For a box. Checking the size etc and if all
3 hit you’re confident this is a bus…
http://ufldl.stanford.edu/tutorial/supervised/MultiLayerNeuralNetworks/
https://stackoverflow.com/questions/38248657/why-does-simple-2-layer-neural-network-cannot-learn-0-0-sequence#38253140
https://stackoverflow.com/questions/1697243/perceptron-learning-algorithm-not-converging-to-0
OK but what’s tensorflow
Collection of API’s to allow you to create, train and
consume the models we are talking about.
Machine learning toolkit in other words
https://www.tensorflow.org/get_started/ - official docs
Colab notebooks are COOL but a bit slow
Other good introductions
https://eu.udacity.com/course/deep-learning--ud730 - Free course from Google
https://developers.google.com/machine-learning/crash-course/ml-intro -
amazing google course
https://developers.google.com/machine-learning/glossary/ -Glossary
https://medium.com/all-of-us-are-belong-to-machines/the-gentlest-introduction-
to-tensorflow-248dc871a224
https://dzone.com/refcardz/introduction-to-tensorflow?chapter=1 - focused on
worked examples in python
https://www.youtube.com/watch?v=MotG3XI2qSs
https://www.youtube.com/watch?v=5DknTFbcGVM
TensorFlow & Go
Just GO?
Java and C supported as well it seems.
Swift and JS just announced and the original C++ and
Python so it may soon become ubiquitous
Getting setup
https://www.tensorflow.org/install/install_go
Hello Gopher Version
Let’s review the hello world version
https://gist.github.com/PatrickWalker/78e7cbaf3bcb791150
5990409a33dfa6
^ added some comments
We can create a graph, setup a session to execute the
graph and scoop out the results. Nice.
It’s exactly the same as the python version...
What’s different?
Tensortflow was initially for C++ and Python. Go is a relative newcomer with it and it’s not
fully featured yet
It is not officially designated to support creation and training of models. Yep that’s right. You
shouldn’t train a model with go…
Ok so it’s not ideal but don’t leave yet.
You can in theory train your model in Go, but the API isn’t stable, but the suggested
‘idiomatic’ way is to train it in python and consume it in go so not all is lost
The idiotmatic way
THE PATRICK WAY
Let some other brainboxes do that bit. It’s the hardest bit.
We’ll just profit on other peoples work.
We will re-use work from other people. GENIUS. If only
there was a common shared place that gave you
confidence...
Tensorflow Hub
https://www.tensorflow.org/hub/
Recently launched.
TensorFlow Hub is a library to foster the publication, discovery, and
consumption of reusable parts of machine learning models. A module is a
self-contained piece of a TensorFlow graph, along with its weights and assets,
that can be reused across different tasks in a process known as transfer
learning.
Other new stuff?
● Tensorflow lite (mobile)
● Tensorflow JS
● Probability API
● Community Focus
More here
https://medium.com/tensorflow/highlights-from-tensorflow-
developer-summit-2018-cd86615714b2
https://www.youtube.com/tensorflow
Twitter Sentiment
Why?
Interested in doing a competitor analysis for a project we are about to
undertake for work.
What I would love to do is get a stream of tweets using a search term. Push
them through a SPECIAL MACHINE (our tensorflow model in this case) and
know if they are positive or negative statements.
Then try and work out common words/themes that show up in both category to
know what is loved and what isn’t loved
Isn’t this overkill
Well there is an api essentially to do it but that probably wouldn’t have been
too interesting for a tensorflow meetup :D
There are ready made github libraries but I struggled to
get actual results from them. Everything was deemed
neutral or positive even if I searched for overwhelmingly
negative things like “Internet Explorer” or “James
Corden” or “middle aged men crowbarring gifs into tech
presentations”
So I started to think about making my
own naive bayes classification system...
How?
Went to lift a fully featured trained twitter sentiment model from the hub…
Doesn’t exist because these are building blocks. It’s more of a library. So there
are text helpers and one even looks at semantic similarity between sentences
but would take a fair amount of building and actual brain power to make the full
thing. That’s not me.
So off to github and scouring blogs I went.
How?
Followed this blog and made an amazing model which would allow us to check
sentiment of strings. AMAZING. Thought porting to go would be easy.
<voiceover> it was not easy </voiceover>
Training the model in Python was pretty straightforward but time consuming
and resource hungry.
Had to change the exported model format after the 2nd go as it had seperated
weights and model which made parsing them again hard.
This left with me with a trained model (github) and now it was time to interact
with it in Go
Go Code
Followed this blog and made an amazing model which would allow us to check
sentiment of strings. AMAZING. Thought porting to go would be easy.
<voiceover> it was not easy </voiceover>
Training the model in Python was pretty straightforward but time consuming
and resource hungry.
Had to change the exported model format after the 2nd go as it had separated
weights and model which made parsing them again hard.
This left with me with a trained model and now it was time to interact with it in
Go...
Go Code
That’s when you realise that unless you define some sort of contract on the
model it can be quite hard to parse and understand the format of the input
tensor etc to get the model going again in another context (go in this case).
Imagine trying to talk to an undocumented api in a language that had no json
helper...
Also don’t have* wonderous helpers like numpy and others to help make the
tensors so it’s a bit hokey in Go atm.
I mean I forked python code which allowed me to do this out of the box so I’m
unsure why you would want to redo half of it in another language.
Summary
● Really interesting area
● If you’re familiar with Go or organizationally invested in
Go you can still get involved in Tensorflow
● It probably isn’t the right thing to do imo. Python is.
● Javascript seems like the priority now for other
languages so not sure when Go will get the love
As of today Go isn’t really the language of ML
The End?
The End

More Related Content

PPTX
Contributing for Beginners PuppetConf 2015
PPTX
C# .NET - Um overview da linguagem
PPT
A PHP Developer’s Note
PPTX
SPC Denver/Boulder - Jan 2020
PDF
Rasmus, Think Again! Agile Framework == Happy Php Developer
PDF
Python overview
PPTX
Launching Learning Content with xAPI
PDF
PHP Doesn't Suck
Contributing for Beginners PuppetConf 2015
C# .NET - Um overview da linguagem
A PHP Developer’s Note
SPC Denver/Boulder - Jan 2020
Rasmus, Think Again! Agile Framework == Happy Php Developer
Python overview
Launching Learning Content with xAPI
PHP Doesn't Suck

Similar to Tensorflow go (20)

PPTX
Data Science Salon: Deep Learning as a Product @ Scribd
PPTX
Prototype4Production Presented at FOSSASIA2015 at Singapore
PPTX
Intro to Drupal Slides - DrupalCampSC 2014
TXT
Upwork time log and difficulty 20160523
PPT
What does OOP stand for?
PDF
Learning through answering
PPTX
Simplifying training deep and serving learning models with big data in python...
PPTX
Untangling spring week8
PDF
Build chatbots with api.ai and Google cloud functions
PDF
A class action
PDF
TOP PYTHON INTERVIEW QUESTIONS AND ANSWERS 2021
PPT
You shouldneverdo
PDF
SaltStack For DevOps, Free Sample
PDF
Js basics
PPTX
Pair Programming - Be the best pair you can be.
PDF
On Selecting JavaScript Frameworks (Women Who Code 10/15)
PPTX
Intro to iteration power point slide.pptx
PPTX
Future proofing design work with Web components
PDF
Monad Fact #6
PPTX
'10 Great but now Overlooked Tools' by Graham Thomas
Data Science Salon: Deep Learning as a Product @ Scribd
Prototype4Production Presented at FOSSASIA2015 at Singapore
Intro to Drupal Slides - DrupalCampSC 2014
Upwork time log and difficulty 20160523
What does OOP stand for?
Learning through answering
Simplifying training deep and serving learning models with big data in python...
Untangling spring week8
Build chatbots with api.ai and Google cloud functions
A class action
TOP PYTHON INTERVIEW QUESTIONS AND ANSWERS 2021
You shouldneverdo
SaltStack For DevOps, Free Sample
Js basics
Pair Programming - Be the best pair you can be.
On Selecting JavaScript Frameworks (Women Who Code 10/15)
Intro to iteration power point slide.pptx
Future proofing design work with Web components
Monad Fact #6
'10 Great but now Overlooked Tools' by Graham Thomas
Ad

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
KodekX | Application Modernization Development
PDF
Modernizing your data center with Dell and AMD
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
A Presentation on Artificial Intelligence
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
Review of recent advances in non-invasive hemoglobin estimation
KodekX | Application Modernization Development
Modernizing your data center with Dell and AMD
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation_ Review paper, used for researhc scholars
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Chapter 3 Spatial Domain Image Processing.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
NewMind AI Weekly Chronicles - August'25 Week I
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A Presentation on Artificial Intelligence
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Ad

Tensorflow go

  • 1. Tensorgo? Using Wistfully looking at Tensorflow in GO
  • 2. ME Background Test, Test Automation, Support, Development, Release Engineering, Management and now back to development with teamwork.com No Data Science? Nope. Just someone who is interested in all the amazing things happening in this space Tensorflow experience About 7 days… yeah honestly you’ll soon see
  • 3. Deep Neural Network - In diagram form
  • 4. Definition Input Layer - Source of data. No transforms just pass it on Bias Nodes - Always on. Always set to 1. Think of it as b in y = ax + b. Shifts a function by allowing flexibility. Hidden Layer - > 1 layer here makes it a deep network. This is where calculations are applied and result past to next layer. Hidden because values not in training set. S Output Layer - Result from the model. During training this is compared to expected and used to change weights to improve model https://ujjwalkarn.me/2016/08/09/quick-intro-neural-networks/
  • 5. Some good intro resources https://stevenmiller888.github.io/mind-how-to-build-a-neural-network/ https://www.quora.com/ELI5-What-are-neural-networks is a nice example and talks about how you would get a computer to learn a ‘square’ function https://stats.stackexchange.com/questions/63152/what-does-the-hidden-layer-in-a-neural-network-compute Talks about hidden layers and classifying pictures of a bus. You might look for wheels. For a box. Checking the size etc and if all 3 hit you’re confident this is a bus… http://ufldl.stanford.edu/tutorial/supervised/MultiLayerNeuralNetworks/ https://stackoverflow.com/questions/38248657/why-does-simple-2-layer-neural-network-cannot-learn-0-0-sequence#38253140 https://stackoverflow.com/questions/1697243/perceptron-learning-algorithm-not-converging-to-0
  • 6. OK but what’s tensorflow Collection of API’s to allow you to create, train and consume the models we are talking about. Machine learning toolkit in other words https://www.tensorflow.org/get_started/ - official docs Colab notebooks are COOL but a bit slow
  • 7. Other good introductions https://eu.udacity.com/course/deep-learning--ud730 - Free course from Google https://developers.google.com/machine-learning/crash-course/ml-intro - amazing google course https://developers.google.com/machine-learning/glossary/ -Glossary https://medium.com/all-of-us-are-belong-to-machines/the-gentlest-introduction- to-tensorflow-248dc871a224 https://dzone.com/refcardz/introduction-to-tensorflow?chapter=1 - focused on worked examples in python https://www.youtube.com/watch?v=MotG3XI2qSs https://www.youtube.com/watch?v=5DknTFbcGVM
  • 9. Just GO? Java and C supported as well it seems. Swift and JS just announced and the original C++ and Python so it may soon become ubiquitous
  • 11. Hello Gopher Version Let’s review the hello world version https://gist.github.com/PatrickWalker/78e7cbaf3bcb791150 5990409a33dfa6 ^ added some comments We can create a graph, setup a session to execute the graph and scoop out the results. Nice. It’s exactly the same as the python version...
  • 12. What’s different? Tensortflow was initially for C++ and Python. Go is a relative newcomer with it and it’s not fully featured yet It is not officially designated to support creation and training of models. Yep that’s right. You shouldn’t train a model with go… Ok so it’s not ideal but don’t leave yet. You can in theory train your model in Go, but the API isn’t stable, but the suggested ‘idiomatic’ way is to train it in python and consume it in go so not all is lost
  • 13. The idiotmatic way THE PATRICK WAY Let some other brainboxes do that bit. It’s the hardest bit. We’ll just profit on other peoples work. We will re-use work from other people. GENIUS. If only there was a common shared place that gave you confidence...
  • 14. Tensorflow Hub https://www.tensorflow.org/hub/ Recently launched. TensorFlow Hub is a library to foster the publication, discovery, and consumption of reusable parts of machine learning models. A module is a self-contained piece of a TensorFlow graph, along with its weights and assets, that can be reused across different tasks in a process known as transfer learning.
  • 15. Other new stuff? ● Tensorflow lite (mobile) ● Tensorflow JS ● Probability API ● Community Focus More here https://medium.com/tensorflow/highlights-from-tensorflow- developer-summit-2018-cd86615714b2 https://www.youtube.com/tensorflow
  • 17. Why? Interested in doing a competitor analysis for a project we are about to undertake for work. What I would love to do is get a stream of tweets using a search term. Push them through a SPECIAL MACHINE (our tensorflow model in this case) and know if they are positive or negative statements. Then try and work out common words/themes that show up in both category to know what is loved and what isn’t loved
  • 18. Isn’t this overkill Well there is an api essentially to do it but that probably wouldn’t have been too interesting for a tensorflow meetup :D There are ready made github libraries but I struggled to get actual results from them. Everything was deemed neutral or positive even if I searched for overwhelmingly negative things like “Internet Explorer” or “James Corden” or “middle aged men crowbarring gifs into tech presentations” So I started to think about making my own naive bayes classification system...
  • 19. How? Went to lift a fully featured trained twitter sentiment model from the hub… Doesn’t exist because these are building blocks. It’s more of a library. So there are text helpers and one even looks at semantic similarity between sentences but would take a fair amount of building and actual brain power to make the full thing. That’s not me. So off to github and scouring blogs I went.
  • 20. How? Followed this blog and made an amazing model which would allow us to check sentiment of strings. AMAZING. Thought porting to go would be easy. <voiceover> it was not easy </voiceover> Training the model in Python was pretty straightforward but time consuming and resource hungry. Had to change the exported model format after the 2nd go as it had seperated weights and model which made parsing them again hard. This left with me with a trained model (github) and now it was time to interact with it in Go
  • 21. Go Code Followed this blog and made an amazing model which would allow us to check sentiment of strings. AMAZING. Thought porting to go would be easy. <voiceover> it was not easy </voiceover> Training the model in Python was pretty straightforward but time consuming and resource hungry. Had to change the exported model format after the 2nd go as it had separated weights and model which made parsing them again hard. This left with me with a trained model and now it was time to interact with it in Go...
  • 22. Go Code That’s when you realise that unless you define some sort of contract on the model it can be quite hard to parse and understand the format of the input tensor etc to get the model going again in another context (go in this case). Imagine trying to talk to an undocumented api in a language that had no json helper... Also don’t have* wonderous helpers like numpy and others to help make the tensors so it’s a bit hokey in Go atm. I mean I forked python code which allowed me to do this out of the box so I’m unsure why you would want to redo half of it in another language.
  • 23. Summary ● Really interesting area ● If you’re familiar with Go or organizationally invested in Go you can still get involved in Tensorflow ● It probably isn’t the right thing to do imo. Python is. ● Javascript seems like the priority now for other languages so not sure when Go will get the love As of today Go isn’t really the language of ML

Editor's Notes

  • #14: https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go#example-PartialRun This approach is actually used in the go doc and referenced in tensorflow getting started
  • #23: There’s been some attempts but you’ll find most of the tutorials on this roll their own tensors