Machine Learning for Developers - Rodolfo Bonnin - E-Book

Machine Learning for Developers E-Book

Rodolfo Bonnin

0,0
34,79 €

oder
-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Most of us have heard about the term Machine Learning, but surprisingly the question frequently asked by developers across the globe is, “How do I get started in Machine Learning?”. One reason could be attributed to the vastness of the subject area because people often get overwhelmed by the abstractness of ML and terms such as regression, supervised learning, probability density function, and so on. This book is a systematic guide teaching you how to implement various Machine Learning techniques and their day-to-day application and development.
You will start with the very basics of data and mathematical models in easy-to-follow language that you are familiar with; you will feel at home while implementing the examples. The book will introduce you to various libraries and frameworks used in the world of Machine Learning, and then, without wasting any time, you will get to the point and implement Regression, Clustering, classification, Neural networks, and more with fun examples. As you get to grips with the techniques, you’ll learn to implement those concepts to solve real-world scenarios for ML applications such as image analysis, Natural Language processing, and anomaly detections of time series data.
By the end of the book, you will have learned various ML techniques to develop more efficient and intelligent applications.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Veröffentlichungsjahr: 2017

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Machine Learning for Developers
Uplift your regular applications with the power of statistics, analytics, and machine learning
Rodolfo Bonnin

BIRMINGHAM - MUMBAI

Machine Learning for Developers

Copyright © 2017 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, and its dealers and distributors will be held liable for any damages caused or alleged to be 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.

First published: October 2017

Production reference: 1241017

Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78646-987-8

www.packtpub.com

Credits

Author

Rodolfo Bonnin

Copy Editor

Safis Editing

Reviewers

Doug Ortiz

Md. Mahmudul Hasan

Project Coordinator

Nidhi Joshi

Commissioning Editor

Veena Pagare

Proofreader

Safis Editing

Acquisition Editor

Vinay Argekar

Indexer

Francy Puthiry

Content Development Editor

Aishwarya Pandere

Graphics

Tania Dutta

Technical Editor

Karan Thakkar

Production Coordinator

Shraddha Falebhai

Foreword

Several technological drivers that arose in the last decade that I made big data possible, irreversibly reshaping the world completely. Among these, machine learning plays a singular role, since it provides the main functionalities required for data analysis, mining, knowledge discovery, and many other features that provide actionable autonomous intelligence in a way invisible but pervasive to most of the systems we use in our daily lives. Although not new, the formalisms and methods within machine learning have quickly evolved, driven by the growing demands of e-commerce, social networks, internet-related services and products, and similar enterprises centered on online business.Breakthroughs in machine learning have been fueled by other technological innovations sprouted and matured within the Hadoop ecosystem, including horizontally scalable computational resources and superior warehousing capabilities that have made the real-time analysis of huge datasets feasible. At the same time, community supported initiatives around the Python programming language have made the use and evolution of sophisticated analysis libraries widspread, giving rise to a remarkable amount of knowledge and experience, at the same time fast and easy to deploy and to put into production.Within machine learning, neural networks play a singular role nowadays. Perhaps the first artificial intelligence paradigm to be proposed more than 70 years ago, neural networks have experienced several cycles of being abandoned by the community only to be rediscovered some years later. This was likely due to the lack of computational power to perform really complex analysis adequately, together with the burdensome task of assembling, training, and testing different topologies by trial and error. This has changed dramatically in recent years, mostly due to the availability of cloud computing, GPUs, and programming libraries that allow the set up of networks with simple scripts. Today, a network with hundreds of millions of degrees of freedom can be assembled in minutes, trained in hours, and put into production in a few days, (obviously, if you know the right technologies to so). This is one of the reasons why most of the radical advancements in computer vision, language understanding, and pattern recognition in general are being driven specifically by different flavors of neural networks that have been proposed recently.

This exponentially growing set of knowledge, techniques, and programming libraries makes most classical texts on the subject obsolete, at least for the deployment of fast and practical applications. For this reason, a book like this can be celebrated as a quick and to-the-point text that provides all the materials required to successfully implement and understand a machine learning application in a single reading. In this book, you will find:

The fundamentals of machine learning tasks (classification, clustering, regression, and data reduction), together with a quick, yet comprehensive introduction to the mathematical and statistical foundations of the subject.

A more detailed presentation of Neural Networks as a learning model, together with basics of the training algorithms, convergence crite0ria, and the evaluation of results.

An introduction the most advanced learning models using more elaborate networks, including convolutional, recurrent, and adversarial networks. Each of the models is analyzed thoroughly, both in theoretical and in practical considerations.

A comprehensive guide to open source software that, together with the previous material, allows the reader to put the concepts into practice very quickly.

This book is highly recommended for practitioners in academia who feel their expertise is becoming outdated, for developers who need to deploy sophisticated machine learning features in business applications, and for anyone willing to gain a broad and practical understanding of machine learning. The author transmits his vast experience in the subject in a very clear and systematic manner, making the book easy to follow and put into practice.

Claudio Delrieux Full Professor at Electric and Computer Engineering Department - Universidad Nacional del Sur Fellow - National Research and Technology Council of Argentina Chair - Imaging Sciences Laboratory

About the Author

Rodolfo Bonnin is a systems engineer and Ph.D. student at Universidad Tecnológica Nacional, Argentina. He has also pursued parallel programming and image understanding postgraduate courses at Universität Stuttgart, Germany.

He has been doing research on high-performance computing since 2005 and began studying and implementing convolutional neural networks in 2008, writing a CPU- and GPU-supporting neural network feedforward stage. More recently he's been working in the field of fraud pattern detection with Neural Networks and is currently working on signal classification using machine learning techniques.

He is also the author of Building Machine Learning Projects with Tensorflow, by Packt Publishing.

About the Reviewers

Doug Ortiz is a Senior Big Data Architect at ByteCubed who has been architecting, developing, and integrating enterprise solutions throughout his whole career. Organizations that leverage his skillset have been able to rediscover and reuse their underutilized data via existing and emerging technologies such as Amazon Web Services, Microsoft Azure, Google Cloud, Microsoft BI stack, Hadoop, Spark, NoSQL databases, SharePoint along with related toolsets and technologies.

He is also, the founder of Illustris, LLC and can be reached at [email protected]

Interesting aspects of his profession include:

Experience integrating multiple platforms and products

Has Big Data, Data Science Certifications, R, and Python Certifications

Helping organizations gain a deeper understanding and value of their current investments in data and existing resources turning them into useful sources of information

Improving, salvaging and architecting projects by utilizing unique and innovative techniques

Reviews regularly books on the topics of Amazon Web Services, Data Science, Machine Learning, R and Cloud Technologies

Hobbies:

Yoga

Scuba diving

I would like to thank my wonderful wife Mila for all her help and support as well as Maria and Nikolay and our wonderful children.

Md. Mahmudul Hasan is currently serving as a Ph.D. researcher at Anglia Ruskin IT Research Institute (ARITI) at Anglia Ruskin University, UK. He worked as a senior lecturer in the department of CSE at Daffodil International University. He graduated from University of Essex, UK and specialized in games and mobile apps development in different platforms.

He has 6+ years of experiences in ICT industry including development to commercialize of small and large software. He is currently serving himself as a country Director and Chair of International Game Developers Association (IGDA) Bangladesh Chapter.

Mahmud's research interests include machine learning, data science, decision support system, and personalized learning through games and gamification. He has significant publications in peer-reviewed journals and conferences.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.

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.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

Fully searchable across every book published by Packt

Copy and paste, print, and bookmark content

On demand and accessible via a web browser

Customer Feedback

Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1786466961.

If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!

Table of Contents

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

Introduction - Machine Learning and Statistical Science

Machine learning in the bigger picture

Types of machine learning

Grades of supervision

Supervised learning strategies - regression versus classification

Unsupervised problem solving–clustering

Tools of the trade–programming language and libraries

The Python language

The NumPy library

The matplotlib library

What's matplotlib?

Pandas

SciPy

Jupyter notebook

Basic mathematical concepts

Statistics - the basic pillar of modeling uncertainty

Descriptive statistics - main operations

Mean

Variance

Standard deviation

Probability and random variables

Events

Probability

Random variables and distributions

Useful probability distributions

Bernoulli distributions

Uniform distribution

Normal distribution

Logistic distribution

Statistical measures for probability functions

Skewness

Kurtosis

Differential calculus elements

Preliminary knowledge

In search of changes–derivatives

Sliding on the slope

Chain rule

Partial derivatives

Summary

The Learning Process

Understanding the problem

Dataset definition and retrieval

The ETL process

Loading datasets and doing exploratory analysis with SciPy and pandas

Working interactively with IPython

Working on 2D data

Feature engineering

Imputation of missing data

One hot encoding

Dataset preprocessing

Normalization and feature scaling

Normalization or standardization

Model definition

Asking ourselves the right questions

Loss function definition

Model fitting and evaluation

Dataset partitioning

Common training terms –  iteration, batch, and epoch

Types of training – online and batch processing

Parameter initialization

Model implementation and results interpretation

Regression metrics

Mean absolute error

Median absolute error

Mean squared error

Classification metrics

Accuracy

Precision score, recall, and F-measure

Confusion matrix

Clustering quality measurements

Silhouette coefficient

Homogeneity, completeness, and V-measure

Summary

References

Clustering

Grouping as a human activity

Automating the clustering process

Finding a common center - K-means

Pros and cons of K-means

K-means algorithm breakdown

K-means implementations

Nearest neighbors

Mechanics of K-NN

Pros and cons of K-NN

K-NN sample implementation

Going beyond the basics

The Elbow method

Summary

References

Linear and Logistic Regression

Regression analysis

Applications of regression

Quantitative versus qualitative variables

Linear regression

Determination of the cost function

The many ways of minimizing errors

Analytical approach

Pros and cons of the analytical approach

Covariance/correlation method

Covariance

Correlation

Searching for the slope and intercept with covariance and correlation

Gradient descent

Some intuitive background

The gradient descent loop

Formalizing our concepts

Expressing recursion as a process

Going practical – new tools for new methods

Useful diagrams for variable explorations – pairplot

Correlation plot

Data exploration and linear regression in practice

The Iris dataset

Getting an intuitive idea with Seaborn pairplot

Creating the prediction function

Defining the error function

Correlation fit

Polynomial regression and an introduction to underfitting and overfitting

Linear regression with gradient descent in practice

Logistic regression

Problem domain of linear regression and logistic regression

Logistic function predecessor – the logit functions

Link function

Logit function

Logit function properties

The importance of the logit inverse

The sigmoid or logistic function

Properties of the logistic function

Multiclass application – softmax regression

Practical example – cardiac disease modeling with logistic regression

The CHDAGE dataset

Dataset format

Summary

References

Neural Networks

History of neural models

The perceptron model

Improving our predictions – the ADALINE algorithm

Similarities and differences between a perceptron and ADALINE

Limitations of early models

Single and multilayer perceptrons

MLP origins

The feedforward mechanism

The chosen optimization algorithm – backpropagation

Types of problem to be tackled

Implementing a simple function with a single-layer perceptron

Defining and graphing transfer function types

Representing and understanding the transfer functions

Sigmoid or logistic function

Playing with the sigmoid

Rectified linear unit or ReLU

Linear transfer function

Defining loss functions for neural networks

L1 versus L2 properties

Summary

References

Convolutional Neural Networks

Origin of convolutional neural networks

Getting started with convolution

Continuous convolution

Discrete convolution

Kernels and convolutions

Stride and padding

Implementing the 2D discrete convolution operation in an example

Subsampling operation (pooling)

Improving efficiency with the dropout operation

Advantages of the dropout layers

Deep neural networks

Deep convolutional network architectures through time

Lenet 5

Alexnet

The VGG model

GoogLenet and the Inception model

Batch-normalized inception V2 and V3

Residual Networks (ResNet)

Types of problem solved by deep layers of CNNs

Classification

Detection

Segmentation

Deploying a deep neural network with Keras

Exploring a convolutional model with Quiver

Exploring a convolutional network with Quiver

Implementing transfer learning

References

Summary

Recurrent Neural Networks

Solving problems with order — RNNs

RNN definition

Types of sequence to be modeled

Development of RNN

Training method — backpropagation through time

Main problems of the traditional RNNs — exploding and vanishing gradients

LSTM

The gate and multiplier operation

Part 1 — set values to forget (input gate)

Part 2 — set values to keep

Part 3 — apply changes to cell

Part 4 — output filtered cell state

Univariate time series prediction with energy consumption data

Dataset description and loading

Dataset preprocessing

Summary

References

Recent Models and Developments

GANs

Types of GAN applications

Discriminative and generative models

Reinforcement learning

Markov decision process

Decision elements

Optimizing the Markov process

Basic RL techniques: Q-learning

References

Summary

Software Installation and Configuration

Linux installation

Initial distribution requirements

Installing Anaconda on Linux

pip Linux installation method

Installing the Python 3 interpreter

Installing pip

Installing necessary libraries

macOS X environment installation

Anaconda installation

Installing pip

Installing remaining libraries via pip

Windows installation

Anaconda Windows installation

Summary

Preface

Machine learning is one of the star disciplines at present. Acclaimed by the media as the future of work, it is said to be part of any significant tech investment in recent months, in a world where everything is driven by data and automation. It is used extensively across many fields such as image understanding, robotics, search engines, self-driving cars, and so on and the number of areas of application increases almost daily. In this book we will study the motivations and current techniques of machine learning using code and diagrams as the main conceptual vehicles, omitting outside the fundamental mathematical results.

We will start talking about the fundamental machine learning concepts, its branches, and types of problems. Then, there will be an explanatory chapter about the fundamental mathematical concepts required to grasp upcoming techniques. As we advance through the chapters, models of increasing complexity and sophistication are explained, starting with linear regression, then logistic regression, neural networks and its more recent variants (CNNs, RNNs),concluding with a synthetic introduction to more advanced machine learning techniques, such as GANs and reinforcement learning.

This book is aimed at developers looking to finally grasp what that machine learning hype is all about, and understand the main fundamental concepts, using an algorithmic point of view, along with more formal mathematical definitions.This book implements code concepts in Python, considering the simplicity of its interface, and the fact that Python offers an unmatched set of tools to continue learning from the book’s code. So, familiarity with Python programming would certainly be helpful for playing around with the code, but it should be manageable from programmers experienced in other languages.

You will learn how to make informed decisions about the types of algorithms you need to solve your own machine learning problems, and a knowledge of how those algorithms work to get the best possible results. If you want to understand machine learning in day-to-day, coder-friendly language, and have just the right amount of information to be able to do the jump into the discipline, this book will definitely come to your rescue!

What this book covers

Chapter 1, Introduction - Machine Learning and Statistical Science, covers various introductory concepts in machine learning. It talks about the history, branches and general discipline concepts. It also gives an introduction to the base mathematical concepts needed to understand most of the techniques developed afterward.

Chapter 2, The Learning Process, covers all the steps in the workflow of a machine learning process and shows useful tools and concept definitions for all those stages.

Chapter 3, Clustering, covers several techniques for unsupervised learning, specially K-Means, and K-NN clustering.

Chapter 4, Linear and Logistic Regression, covers two pretty different supervised learning algorithms, which go under a similar name: linear regression (which we will use to perform time series predictions), and logistic regression (which we will use for classification purposes).

Chapter 5, Neural Networks, covers one of the basic building blocks of modern machine learning Applications, and ends with the practical step-by-step building of a neural network.

Chapter 6, Convolutional Neural Networks, covers this powerful variation of neural networks, and ends with a practical tour of the internals of a very well known architecture of CNN, called VGG16, in a practical application.

Chapter 7, Recurrent Neural Networks, covers an overview of the RNN concept and a complete depiction of all the stages of the most used architecture, the LSTM. Finally, a practical exercise in time series prediction is shared.

Chapter 8, Recent Models and Developments, covers two upcoming techniques that have engaged huge interest in the field: generative adversarial networks, and the whole reinforcement learning field.

Chapter 9, Software Installation and Configuration, It covers the installation of all the necessary software packages, for three operative systems: Linux, macOS, and Windows.

What you need for this book

This book is focused on machine learning concepts and uses as a Python language (version 3) as a computational tool . We have used Python 3 and the Jupyter Notebook to build our workbooks, which you can edit and play with to better understand the concepts. We focus on how to utilize various Python libraries in the best possible way to build real-world applications. In that spirit, we have tried to keep all the code as friendly and readable as possible. We feel that this will enable our readers to easily understand the code and readily use it in different scenarios.

Who this book is for

This book is for developers/tech enthusiasts who want to understand the basics of machine learning concepts through a computationally-intensive approach. This book should be suited to people who have programmed in any scripting language, but being familiar with Python will be useful to play around with the code. It will also be useful for current data scientists to get back to the basic concepts, and understand them using a novel, hands-on approach.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, path names, dummy URLs, user input, and Twitter handles are shown as follows: "Let's generate a large number of events of a Bernoulli distribution using np and graph the tendency of this distribution."

A block of code is set as follows:

def mean(sampleset): #Definition header for the mean function total=0 for element in sampleset: total=total+element return total/len(sampleset)

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "In order to download new modules, we will go toFiles|Settings|Project Name|Project Interpreter."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important to us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply email [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book 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 emailed directly to you. You can download the code files by following these steps:

Log in or register to our website using your email address and password.

Hover the mouse pointer on the

SUPPORT

tab at the top.

Click on

Code Downloads & Errata

.

Enter the name of the book in the

Search

box.

Select the book for which you're looking to download the code files.

Choose from the drop-down menu where you purchased this book from.

Click on

Code Download

.

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/Machine-Learning-for-Developers. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.

Introduction - Machine Learning and Statistical Science

Machine learning has definitely been one of the most talked about fields in recent years, and for good reason. Every day new applications and models are discovered, and researchers around the world announce impressive advances in the quality of results on a daily basis.

Each day, many new practitioners decide to take courses and search for introductory materials so they can employ these newly available techniques that will improve their applications. But in many cases, the whole corpus of machine learning,as normally explained in the literature, requires a good understanding of mathematical concepts as a prerequisite, thus imposing a high bar for programmers who typically have good algorithmic skills but are less familiar with higher mathematical concepts.

This first chapter will be a general introduction to the field, covering the main study areas of machine learning, and will offer an overview of the basic statistics, probability, and calculus, accompanied by source code examples in a way that allows you to experiment with the provided formulas and parameters.

In this first chapter, you will learn the following topics:

What is machine learning?

Machine learning areas

Elements of statistics and probability

Elements of calculus

The world around us provides huge amounts of data. At a basic level, we are continually acquiring and learning from text, image, sound, and other types of information surrounding us. The availability of data, then, is the first step in the process of acquiring the skills to perform a task.

A myriad of computing devices around the world collect and store an overwhelming amount of information that is image-, video-, and text-based. So, the raw material for learning is clearly abundant, and it's available in a format that a computer can deal with.

That's the starting point for the rise of the discipline discussed in this book: the study of techniques and methods allowing computers to learn from data without being explicitly programmed.

A more formal definition of machine learning, from Tom Mitchell, is as follows:

"A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E."

This definition is complete, and reinstates the elements that play a role in every machine learning project: the task to perform, the successive experiments, and a clear and appropriate performance measure. In simpler words, we have a program that improves how it performs a task based on experience and guided by a certain criterion.

Machine learning in the bigger picture

Machine learning as a discipline is not an isolated field—it is framed inside a wider domain, Artificial Intelligence (AI). But as you can guess, machine learning didn't appear from the void. As a discipline it has its predecessors, and it has been evolving in stages of increasing complexity in the following four clearly differentiated steps:

The first model of machine learning involved rule-based decisions and a simple level of data-based algorithms that includes in itself, and as a prerequisite, all the possible ramifications and decision rules, implying that all the possible options will be hardcoded into the model beforehand by an expert in the field. This structure was implemented in the majority of applications developed since the first programming languages appeared in 1950. The main data type and function being handled by this kind of algorithm is the Boolean

, as it exclusively dealt with yes or no decisions.

During the second developmental stage of statistical reasoning, we started to let the probabilistic characteristics of the data have a say, in addition to the previous choices set up in advance. This better reflects the fuzzy nature of real-world problems, where outliers are common and where it is more important to take into account the nondeterministic tendencies of the data than the rigid approach of fixed questions. This discipline adds to the mix of mathematical tools elements of

Bayesian probability theory

. Methods pertaining to this category include curve fitting (usually of linear or polynomial), which has the common property of working with numerical data.

The machine learning stage is the realm in which we are going to be working throughout this book, and it involves more complex tasks than the simplest Bayesian elements of the previous stage. The most outstanding feature of machine learning algorithms is that they can generalize models from data but the models are capable of generating their own feature selectors, which aren't limited by a rigid target function, as they are generated and defined as the training process evolves. Another differentiator of this kind of model is that they can take a large variety of data types as input, such as speech, images, video, text, and other data susceptible to being represented as vectors.

AI is the last step in the scale of abstraction capabilities that,

in a way,

include all previous algorithm types, but with one key difference: AI algorithms are able to apply the learned knowledge to solve tasks that had never been considered during training. The types of data with which this algorithm works are even more generic than the types of data supported by machine learning, and they should be able, by definition, to transfer problem-solving capabilities from one data type to another, without a complete retraining of the model. In this way, we could develop an algorithm for object detection in black and white images and the model could abstract the knowledge to apply the model to color images.

In the following diagram, we represent these four stages of development towards real AI applications:

Types of machine learning

Let's try to dissect the different types of machine learning project, starting from the grade of previous knowledge from the point of view of the implementer. The project can be of the following types:

Supervised learning

: In this type of learning, we are given a sample set of real data, accompanied by the result the model should give us after applying it. In statistical terms, we have the outcome of all the training set experiments.

Unsupervised learning:

This type of learning provides only the sample data from the problem domain, but the task of grouping similar data and applying a category has no previous information from which it can be inferred.

Reinforcement learning:

This type of learning doesn't have a labeled sample set and has a different number of participating elements, which include an agent, an environment, and learning an optimum policy or set of steps, maximizing a goal-oriented approach by using rewards or penalties (the result of each attempt).

Take a look at the following diagram:

Main areas of Machine Learning

Grades of supervision

The learning process supports gradual steps in the realm of supervision:

Unsupervised Learning doesn't have previous knowledge of the class or value of any sample, it should infer it automatically.

Semi-Supervised Learning, needs a seed of known samples, and the model infers the remaining samples class or value from that seed.

Supervised Learning: This approach normally includes a set of known samples, called training set, another set used to validate the model's generalization, and a third one, called test set, which is used after the training process to have an independent number of samples outside of the training set, and warranty independence of testing.

In the following diagram, depicts the mentioned approaches: