Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Extending k8s API and Lesser known neural networks in Go

Milos Gajdos
November 01, 2017

Extending k8s API and Lesser known neural networks in Go

Slides from the talk I gave at Golang Taipei on 31st October, 2017

Milos Gajdos

November 01, 2017
Tweet

More Decks by Milos Gajdos

Other Decks in Technology

Transcript

  1. ABOUT ME ▸ Masters in Cybernetics, CTU, Prague ▸ Started

    Kubernetes London Meetup ▸ Containers: https://containerops.org/ ▸ Machine Learning: https://mlexplore.org/ ▸ Twitter: @milosgajdos ▸ Github: milosgajdos83
  2. KUBERNETES LONDON MEETUP ▸ Started w/ Peter Idah (@peteridah) in

    Feb 2015 ▸ Currently almost 2k members ▸ Growing strong…still
  3. KUBERNETES IN NUTSHELL ▸ Users interact with k8s [only] via

    API service ▸ Everything [useful] is an API object ▸ Users create them, Control Plane manages them ▸ Control Plane is a “Kernel”, APIs are “standard libs”
  4. CUSTOM RESOURCE DEFINITION (CRD) ▸ Extend k8s API with custom

    objects ▸ CDRs allow to use familiar UX: kubectl ▸ On their own just “dumb” storage of structured data ▸ Powerful in combination with CONTROLLERS
  5. CDR CONTROLLERS IN GO ▸ Easy to create, well…sort of

    :-) ▸ Sample controller:
 https://github.com/kubernetes/sample-controller ▸ Dig into the code deeper: 
 https://goo.gl/d12pQK ▸ Go even deeper: API aggregation ▸ Credit: James Munnelly (@JamesMunnelly )
  6. WHY GO AND NEURAL NETWORKS ▸ Go is fun! Well,

    most of the time ;-) ▸ Statically typed language, memory safe ▸ Easy concurrency ▸ Reasonably fast [and still improving] runtime
  7. GO FOR NUMERICAL & SCIENTIFIC COMPUTING ▸ gonum: set of

    Go libraries for scientific computing
 https://www.gonum.org ▸ Numerical computations and optimization problems:
 https://github.com/gonum/gonum ▸ Particularly interesting packages:
 mat: matrix operations
 optimize: optimisation problems ▸ Plotting graphs:
 https://github.com/gonum/plot
  8. SOME NOTES ▸ The result of Matrix operation stored in

    receiver: ▸ Receiver must be initialized! ▸ Receiver get mutated by the operation! ▸ Panics when the indexes are out of bounds! ▸ Some operations return Vector, not Matrix! ▸ You can access raw backing data (float64 slices)
  9. SELF ORGANISING MAPS (SOM) ▸ Data clustering ▸ Unsupervised learning

    ▸ gosom: SOM implementation in Go
 https://github.com/milosgajdos83/gosom ▸ http://mlexplore.org/2017/01/13/ self-organizing-maps-in-go/
  10. HOPFIELD NETWORKS ▸ Associative memory ▸ Supervised learning ▸ gopfield:

    Hopfield networks in Go
 https://github.com/milosgajdos83/gopfield ▸ http://mlexplore.org/2017/03/12/ hopfield-networks-in-go/
  11. TIPS AND TRICKS ▸ Sometimes looping over a raw vector

    slice is faster than multiplying vectors using mat package functions
 AVOID UNNECESSARY ALLOCATIONS ▸ Avoid re-computing CPU “expensive” values (pow, exp…)
 CACHE AND RE-USE EXPENSIVE COMPUTATIONS ▸ Go Profiler is pretty awesome and it’s your best friend
 AVOID PREMATURE OPTIMISATIONS
  12. SUMMARY ▸ Extending k8s API is simple and can give

    you super powers ▸ Neural Networks in Go are fun, but Python + CUDA still faster ▸ Stay awesome and keep hacking in Go!
  13. REFERENCES ▸ Gist from this talk
 https://gist.github.com/milosgajdos83/ de311c901572644481d4b5dd3830d6cc ▸ Awesome

    list of Go for data science resources
 https://github.com/gopherdata/resources ▸ gorgonnia = Go + CUDA
 https://github.com/chewxy/gorgonia ▸ Go + FPGA
 https://github.com/ReconfigureIO