O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Go Machine Learning Projects

Book Description

Work through exciting projects to explore the capabilities of Go and Machine Learning

Key Features

  • Explore ML tasks and Go's machine learning ecosystem
  • Implement clustering, regression, classification, and neural networks with Go
  • Get to grips with libraries such as Gorgonia, Gonum, and GoCv for training models in Go

Book Description

Go is the perfect language for machine learning; it helps to clearly describe complex algorithms, and also helps developers to understand how to run efficient optimized code. This book will teach you how to implement machine learning in Go to make programs that are easy to deploy and code that is not only easy to understand and debug, but also to have its performance measured.

The book begins by guiding you through setting up your machine learning environment with Go libraries and capabilities. You will then plunge into regression analysis of a real-life house pricing dataset and build a classification model in Go to classify emails as spam or ham. Using Gonum, Gorgonia, and STL, you will explore time series analysis along with decomposition and clean up your personal Twitter timeline by clustering tweets. In addition to this, you will learn how to recognize handwriting using neural networks and convolutional neural networks. Lastly, you'll learn how to choose the most appropriate machine learning algorithms to use for your projects with the help of a facial detection project.

By the end of this book, you will have developed a solid machine learning mindset, a strong hold on the powerful Go toolkit, and a sound understanding of the practical implementations of machine learning algorithms in real-world projects.

What you will learn

  • Set up a machine learning environment with Go libraries
  • Use Gonum to perform regression and classification
  • Explore time series models and decompose trends with Go libraries
  • Clean up your Twitter timeline by clustering tweets
  • Learn to use external services for your machine learning needs
  • Recognize handwriting using neural networks and CNN with Gorgonia
  • Implement facial recognition using GoCV and OpenCV

Who this book is for

If you're a machine learning engineer, data science professional, or Go programmer who wants to implement machine learning in your real-world projects and make smarter applications easily, this book is for you. Some coding experience in Golang and knowledge of basic machine learning concepts will help you in understanding the concepts covered in this book.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Go Machine Learning Projects
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  6. How to Solve All Machine Learning Problems
    1. What is a problem? 
    2. What is an algorithm? 
    3. What is machine learning? 
    4. Do you need machine learning?
    5. The general problem solving process
    6. What is a model?
      1. What is a good model?
    7. On writing and chapter organization 
    8. Why Go? 
    9. Quick start
    10. Functions
    11. Variables
      1. Values 
      2. Types 
      3. Methods 
      4. Interfaces
      5. Packages and imports
    12. Let's Go! 
  7. Linear Regression - House Price Prediction
    1. The project
    2. Exploratory data analysis
      1. Ingestion and indexing
      2. Janitorial work
        1. Encoding categorical data
        2. Handling bad numbers
        3. Final requirement
        4. Writing the code
      3. Further exploratory work
        1. The conditional expectation functions
        2. Skews
        3. Multicollinearity
      4. Standardization
    3. Linear regression
      1. The regression
      2. Cross-validation
        1. Running the regression
    4. Discussion and further work
    5. Summary
  8. Classification - Spam Email Detection
    1. The project 
    2. Exploratory data analysis 
      1. Tokenization
      2. Normalizing and lemmatizing
      3. Stopwords
      4. Ingesting the data
        1. Handling errors
    3. The classifier
    4. Naive Bayes
      1. TF-IDF 
      2. Conditional probability
      3. Features
      4. Bayes' theorem
    5. Implementating the classifier
      1. Class
        1. Alternative class design
      2. Classifier part II
    6. Putting it all together
    7. Summary
  9. Decomposing CO2 Trends Using Time Series Analysis
    1. Exploratory data analysis
      1. Downloading from non-HTTP sources
      2. Handling non-standard data
      3. Dealing with decimal dates
      4. Plotting
        1. Styling
    2. Decomposition
      1. STL
        1. LOESS
        2. The algorithm
        3. Using STL
        4. How to lie with statistics
      2. More plotting
        1. A primer on Gonum plots
        2. The residuals plotter
        3. Combining plots
    3. Forecasting
      1. Holt-Winters
    4. Summary
    5. References
  10. Clean Up Your Personal Twitter Timeline by Clustering Tweets
    1. The project 
    2. K-means 
    3. DBSCAN
    4. Data acquisition
    5. Exploratory data analysis
    6. Data massage
      1. The processor 
      2. Preprocessing a single word 
        1. Normalizing a string
        2. Preprocessing stopwords
        3. Preprocessing Twitter entities 
      3. Processing a single tweet 
    7. Clustering 
      1. Clustering with K-means 
      2. Clustering with DBSCAN 
      3. Clustering with DMMClust 
    8. Real data
    9. The program 
    10. Tweaking the program
      1. Tweaking distances 
      2. Tweaking the preprocessing step 
    11. Summary
  11. Neural Networks - MNIST Handwriting Recognition
    1. A neural network
      1. Emulating a neural network
    2. Linear algebra 101
      1. Exploring activation functions
    3. Learning
    4. The project
      1. Gorgonia
      2. Getting the data
        1. Acceptable format
        2. From images to a matrix
      3. What is a tensor?
        1. From labels to one-hot vectors
        2. Visualization
        3. Preprocessing
      4. Building a neural network
      5. Feed forward
      6. Handling errors with maybe
      7. Explaining the feed forward function
      8. Costs
      9. Backpropagation
    5. Training the neural network
    6. Cross-validation
    7. Summary
  12. Convolutional Neural Networks - MNIST Handwriting Recognition
    1. Everything you know about neurons is wrong 
    2. Neural networks – a redux
      1. Gorgonia
        1. Why?
        2. Programming
        3. What is a tensor? – part 2
        4. All expressions are graphs
      2. Describing a neural network
        1. One-hot vector
    3. The project
      1. Getting the data
      2. Other things from the previous chapter
    4. CNNs
      1. What are convolutions?
        1. How Instagram filters work
        2. Back to neural networks
      2. Max-pooling
      3. Dropout
    5. Describing a CNN
      1. Backpropagation
    6. Running the neural network
    7. Testing
      1. Accuracy
    8. Summary
  13. Basic Facial Detection
    1. What is a face? 
      1. Viola-Jones
    2. PICO 
      1. A note on learning 
    3. GoCV 
      1. API 
    4. Pigo
    5. Face detection program 
      1. Grabbing an image from the webcam 
      2. Displaying the image 
      3. Doodling on images 
      4. Face detection 1 
      5. Face detection 2
      6. Putting it all together
    6. Evaluating algorithms
    7. Summary
  14. Hot Dog or Not Hot Dog - Using External Services
    1. MachineBox
    2. What is MachineBox?
      1. Signing in and up 
      2. Docker installation and setting up
      3. Using MachineBox in Go
    3. The project
      1. Training 
      2. Reading from the Webcam 
      3. Prettifying the results
    4. The results
    5. What does this all mean? 
    6. Why MachineBox?
    7. Summary
  15. What's Next?
    1. What should the reader focus on? 
      1. The practitioner 
      2. The researcher 
    2. The researcher, the practitioner, and their stakeholder
    3. What did this book not cover?
    4. Where can I learn more?
    5. Thank you
  16. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think