31,19 €
Explore supervised and unsupervised learning techniques and add smart features to your applications
Key FeaturesLeverage machine learning techniques to build real-world applicationsUse the Accord.NET machine learning framework for reinforcement learningImplement machine learning techniques using Accord, nuML, and EncogBook Description
The necessity for machine learning is everywhere, and most production enterprise applications are written in C# using tools such as Visual Studio, SQL Server, and Microsoft Azur2e. Hands-On Machine Learning with C# uniquely blends together an understanding of various machine learning concepts, techniques of machine learning, and various available machine learning tools through which users can add intelligent features.These tools include image and motion detection, Bayes intuition, and deep learning, to C# .NET applications.
Using this book, you will learn to implement supervised and unsupervised learning algorithms and will be better equipped to create excellent predictive models. In addition, you will learn both supervised and unsupervised forms of regression, mainly logistic and linear regression, in depth. Next, you will use the nuML machine learning framework to learn how to create a simple decision tree. In the concluding chapters, you will use the Accord.Net machine learning framework to learn sequence recognition of handwritten numbers using dynamic time warping. We will also cover advanced concepts such as artificial neural networks, autoencoders, and reinforcement learning.
By the end of this book, you will have developed a machine learning mindset and will be able to leverage C# tools, techniques, and packages to build smart, predictive, and real-world business applications.
What you will learnLearn to parameterize a probabilistic problemUse Naive Bayes to visually plot and analyze dataPlot a text-based representation of a decision tree using nuMLUse the Accord.NET machine learning framework for associative rule-based learningDevelop machine learning algorithms utilizing fuzzy logicExplore support vector machines for image recognitionUnderstand dynamic time warping for sequence recognitionWho this book is for
Hands-On Machine Learning with C#is forC# .NETdevelopers who work on a range of platforms from .NET and Windows to mobile devices. Basic knowledge of statistics is required.
Matt R. Cole is a seasoned developer with 30 years' experience in Microsoft Windows, C, C++, C#, and .NET. He previously wrote a speech and audio VOIP system for NASA for use with the Space Shuttle and a space station. He is the owner of Evolved AI Solutions, a premier provider of advanced ML/Bio-AI technologies. He developed the first enterprise-grade microservice framework (written fully in C# and .NET) used by a major hedge fund in NYC and he also developed the first Bio-AI Swarm framework, which fully integrates mirror and canonical neurons.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 212
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Pravin DhandreAcquisition Editor:Aman SinghContent Development Editor:Mayur PawanikarTechnical Editor: Suwarna PatilCopy Editor: Vikrant PhadkeyProject Coordinator:Nidhi JoshiProofreader:SAFISIndexer:Mariammal ChettiyarGraphics:Tania DuttaProduction Coordinator:Shantanu Zagade
First published: May 2018
Production reference: 1210518
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78899-494-1
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and, as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Matt R. Cole is a seasoned developer with 30 years' experience in Microsoft Windows, C, C++, C#, and .NET. He previously wrote a speech and audio VOIP system for NASA for use with the Space Shuttle and a space station. He is the owner of Evolved AI Solutions, a premier provider of advanced ML/Bio-AI technologies. He developed the first enterprise-grade microservice framework (written fully in C# and .NET) used by a major hedge fund in NYC and he also developed the first Bio-AI Swarm framework, which fully integrates mirror and canonical neurons.
Giuseppe Ciaburro holds a PhD in environmental technical physics and two master's degrees. His research is on machine learning applications in the study of urban sound environments. He works at the Built Environment Control Laboratory, Università degli Studi della Campania Luigi Vanvitelli (Italy). He has over 15 years' experience in programming Python, R, and MATLAB, first in the field of combustion, and then in acoustics and noise control. He has several publications to his credit.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Hands-On Machine Learning with C#
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Machine Learning Basics
Introduction to machine learning
Data mining
Artificial Intelligence
Bio-AI
Deep learning
Probability and statistics
Approaching your machine learning project
Data collection
Data preparation
Model selection and training
Model evaluation
Model tuning
Iris dataset
Types of Machine Learning
Supervised learning
Bias-variance trade-off
Amount of training data
Input space dimensionality
Incorrect output values
Data heterogeneity
Unsupervised learning
Reinforcement learning
Build, buy, or open source
Additional reading
Summary
References
ReflectInsight – Real-Time Monitoring
Router
Log Viewer
Live Viewer
Message navigation
Message properties
Watches
Bookmarks
Call Stack
Searching through your messages
Advanced Search
Time zone formatting
Auto Save/Purge
Example
ReflectInsight Utilities: 
Watches
Software Development Kit
Configuration editor
Overview
XML configuration
Dynamic configuration
Main Screen
Summary
Bayes Intuition – Solving the Hit and Run Mystery and Performing Data Analysis
Overviewing Bayes' theorem
Overviewing Naive Bayes and plotting data
Plotting data
Summary
References
Risk versus Reward – Reinforcement Learning
Overviewing reinforcement learning
Types of learning
Q-learning
SARSA
Running our application
Tower of Hanoi
Summary
References
Fuzzy Logic – Navigating the Obstacle Course
Fuzzy logic
Fuzzy AGV
Summary
References
Color Blending – Self-Organizing Maps and Elastic Neural Networks
Under the hood of an SOM
Summary
Facial and Motion Detection – Imaging Filters
Facial detection
Motion detection
Adding detection to your application
Summary
Encyclopedias and Neurons – Traveling Salesman Problem
Traveling salesman problem
Learning rate parameter
Learning radius
Summary
Should I Take the Job – Decision Trees in Action
Decision tree
Decision node
Decision variable
Decision branch node collection
Should I take the job?
numl
Accord.NET decision trees
Learning code
Confusion matrix
True positives
True negatives
False positives
False negatives
Recall
Precision
Error type visualization
Summary
References
Deep Belief – Deep Networks and Dreaming
Restricted Boltzmann Machines
Layering
What does a computer dream?
Summary
References
Microbenchmarking and Activation Functions
Visual activation function plotting
Plotting all functions
The main Plot function
Benchmarking
Summary
Intuitive Deep Learning in C# .NET
What is deep learning?
OpenCL
OpenCL hierarchy
Compute kernel
Compute program
Compute sampler
Compute device
Compute resource
Compute object
Compute context
Compute command queue
Compute buffer
Compute event
Compute image
Compute platform
Compute user event
The Kelp.Net Framework
Functions
Function stacks
Function dictionaries
Caffe1
Chainer
Loss
Model saving and loading
Optimizers
Datasets
CIFAR
CIFAR-10
CIFAR-100
MNIST
Tests
Monitoring Kelp.Net
Watches
Messages
Properties
Weaver
Writing tests
Benchmarking functions
Running a Single Benchmark
Summary
References
Quantum Computing – The Future
Superposition
Teleportation
Entanglement
CNOT
H
M
Summary
In our daily work, which is predominantly information technology, the necessity of machine learning is everywhere and is demanded by all developers, programmers, and analysts. But why use C# for machine learning? The answer is, most production enterprise applications are written in C# using tools such as Visual Studio, SQL Server, Unity, and Microsoft Azure.
This book provides an intuitive understanding of various concepts, the techniques of machine learning, and various machine learning tools through which users can add intelligent features such as image and motion detection, Bayes intuition, deep learning and belief, and more to C# .NET applications.
Using this book, you will implement supervised and unsupervised learning algorithms and will be well equipped to create good predictive models. You will learn numerous techniques and algorithms, right from simple linear regression, decision trees, and SVM to advanced concepts such as artificial neural networks, autoencoders, and reinforcement learning.
By the end of this book, you will have developed a machine learning mindset and will be able to leverage C# tools, techniques, and packages to build smart, predictive, and real-world business applications.
This book is for developers with experience of C# and .NET. No other experience is require or assumed—just a passion for machine learning, artificial intelligence, and deep learning.
Chapter 1, Machine Learning Basics, provides an introduction to machine learning as well as what we hope to accomplish in this book.
Chapter 2, ReflectInsight – Real-Time Monitoring, introduces ReflectInsight, a powerful, flexible, and rich framework that we will use throughout the book for logging and insight into our algorithms.
Chapter 3, Bayes Intuition – Solving the Hit and Run Mystery and Performing Data Analysis, exposes the reader to Bayes intuition. We will also examine and solve the famous "hit and run" problem, where we try to determine who fled the scene of an accident.
Chapter 4, Risk versus Reward – Reinforcement Learning, shows how reinforcement learning works.
Chapter 5, Fuzzy Logic – Navigating the Obstacle Course, implements fuzzy logic to guide our autonomous guided vehicle around an obstacle course. We'll show how to load various maps, and how our autonomous vehicle receives rewards and penalties for making correct and incorrect decisions.
Chapter 6, Color Blending – Self-Organizing Maps and Elastic Neural Networks, exposes the reader to the power of SOM by showing how we can take random colors and blend them together. This provides the reader with a very simple intuition regarding Self Organizing Maps.
Chapter 7, Facial and Motion Detection – Imaging Filters, give the reader a very simple framework to quickly add facial and motion detection capabilities to their program. We provide various examples of both facial and motion detection, explain various algorithms we will use, and meet Frenchie, our dedicated French Bulldog Assistant!
Chapter 8, Encyclopedias and Neurons – Traveling Salesman Problem, uses neurons to solve the age-old Traveling Salesman Problem, where our salesman has been given a map of houses he must visit in order to sell encyclopedias. In order to meet his goals, he must choose the shortest path while only visiting each house once, and end up back where he started.
Chapter 9, Should I Take the Job – Decision Trees in Action, exposes the reader to decision trees using two different open source frameworks. We will use decision trees to answer the question, Should I Take the Job?
Chapter 10, Deep Belief - Deep Networks and Dreaming, covers an open source framework SharpRBM. We will delve into the world of Boltzmann and Restricted Boltzmann machines. We will ask and answer the question, What do computers dream when they dream?
Chapter 11, Microbenchmarking and Activation Functions, exposes the reader to Benchmark.Net, an open source microbenchmarking framework. We will show the reader how to benchmark code and functions. We will also explain what an activation function is and show how we have microbenchmarked many of the activation functions in use today. The reader will gain valuable insights into the time each function takes, as well as the timing difference between using floats and doubles.
Chapter 12, Intuitive Deep Learning in C# .NET, covers an open source framework named Kelp.Net. This framework is the most powerful deep learning framework available for C# .NET developers. We will show the reader how to perform many operations and tests using the framework, and integrate this with ReflectInsight to get incredible, rich information about our deep learning algorithms.
Chapter 13, Quantum Computing – The Future, expose the reader to the future, the world of quantum computing.
You should be familiar with basic development of C# and .NET
You should have a passion for machine learning and open source projects
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packtpub.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Machine-Learning-with-CSharp In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/HandsOnMachineLearningwithCSharp_ColorImages.pdf.
Feedback from our readers is always welcome.
General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
Hello everyone, and welcome to Machine Learning Using C# and .NET. Our goal in this book is to expose you, a seasoned C# .NET developer, to the many open source machine learning frameworks that are available, as well as examples of using those packages. Along the way, we'll talk about logging, facial and motion detection, decision trees, image recognition, intuitive deep learning, quantum computing, and more. In many cases, you'll be up and running within minutes. It's my true hope that there is something for everyone in this series. Most importantly, having dealt with developers for 30 years now, here's why I wrote this book.
As a lifelong Microsoft developer, I have often watched developers struggle to find the resources needed for everyday problems. Let's face it, none of us have the time to do things the way we like, and few of us are fortunate enough to work in a true research and development unit. We've made quite a journey over the years though, from those of us old enough to remember having the sentinel copy of the C programmers' reference and 50 other books on our desk, to now being able to type in a quick search into Google and get exactly (okay, sometimes exactly) what we are looking for. But now that the age of AI is among us, things take a bit of a different turn. As C# developers, Google search isn't always our best friend when it comes to machine learning because almost everything being used is Python, R, MATLAB, and Octave. We also have to remember that machine learning has been around for many years; it's just recently that corporate America has embraced it and we're seeing more and more people become involved. The computing power is now available, and the academia has made incredible strides and progress in bringing it out into the world. But the world, my friends, as you have no doubt heard, is a scary place! Where is a C# .NET developer to turn? Let's start answering this question with a short story in the next section, which, unfortunately, is as true as the sky is blue. At least here in sunny Florida!
In this chapter, we are going to learn the following topics:
Data mining
Artificial Intelligence
(
AI
) and bio-AI
Deep learning
Probability and statistics
Supervised learning
Unsupervised learning
Reinforcement learning
Whether to buy, build or open source
I once had a boss whom I told I was using machine learning to discover more about our data. His response was, What do you think you can learn that I don't already know! If you haven't encountered one of those in your career, congratulations. Also let me know if you have any openings! But you more than likely have, or will. Here's how it was handled. And no, I didn't quit!
So, let's be honest folks. Sometimes, no amount of logic will override blinders or resistance to change, but the story has a much different and more important meaning behind it than a boss who defies everything we learned in biology. In the world of machine learning, it's a lot harder to prove/show what's going on, whether or not things are working, how they are working, why they are (or are not) working, and so on to someone who isn't in the day-to-day trenches of development like you are. And even then, it could be very difficult for you to understand what the algorithm is doing as well.
Here are just some of the questions you should be asking yourself when it comes to deciding whether or not machine learning is right for you:
Are you just trying to be
buzzword compliant
(which might be what's really being asked for) or is there a true need for this type of solution?
Do you have the data you need?
Is the data clean enough for usage (more on that later)?
Do you know where, and whether, you can get data that you might be missing? More importantly, how do you know that data is in fact missing?
Do you have a lot of data or just a small amount?
Is there another known and proven solution that already exists that we could use instead?
Do you know what you are trying to accomplish?
Do you know how you are going to accomplish it?
How will you explain it to others?
How will you be able to prove what's going on under the hood when asked?
These are just some of the many questions we will tackle together as we embark on our machine learning journey. It's all about developing what I call the machine learning mindset.
Nowadays, it seems that if someone does a SQL query that returns more than one row, they call themselves a data scientist. Fair enough for the resume; everyone needs a pat on the back occasionally, even if it's self-provided. But are we really operating as data scientists, and what exactly does data scientist mean? Are we really doing machine learning, and what exactly does that mean? Well, by the end of this book, we'll hopefully have found the answers to all of that, or at the very least, created an environment where you can find the answers on your own!
Not all of us have the luxury of working in the research or academic world. Many of us have daily fires to fight, and the right solution just might be a tactical solution that has to be in place in 2 hours. That's what we, as C# developers, do. We sit behind our desks all day, headphones on if we're lucky, and type away. But do we ever really get the full time we want or need to develop a project the way we'd like? If we did, there wouldn't be as much technical debt in our projects as we have, right (you do track your technical debt, right)?
We need to be smart about how we can get ahead of the curve, and sometimes we do that by thinking more than we code, especially upfront. The academic side of things is invaluable; there's simply no replacement for knowledge. But most production code in corporate America isn't written in academic languages such as Python, R, Matlab and Octave. Even though all that academic wealth is available, it's not available in the form that suits us best to do our jobs.
In the meantime, let's stop and praise those that contribute to the open source community. It is because of them that we have some excellent third-party open source solutions out there that we can leverage to get the job done. It's such a privilege that the open source community allows us to utilize what they have developed, and the objective of this book is to expose you to just some of those tools and show how you can use them. Along the way, we'll try and give you at least some of the basic behind-the-scenes knowledge that you should know, just so that everything isn't a black hole versus a black box!
