
eBook - ePub
Machine Learning for Beginners
A Plain English Introduction to Artificial Intelligence and Machine Learning
- English
- ePUB (mobile friendly)
- Available on iOS & Android
eBook - ePub
Machine Learning for Beginners
A Plain English Introduction to Artificial Intelligence and Machine Learning
About this book
So you've heard a lot about AI and Machine learning. But what does it actually mean?
This book could be the answer you're looking for... This book is an introduction to basic machine learning and artificial intelligence. It gives you a list of applications, and also a few examples of the different types of machine learning. Here's What You'll Learn in this Book:
Introduction to Machine LearningDifferent Applications of Machine LearningIntroduction to Statistics for Machine LearningSupervised LearningUnsupervised LearningReinforced LearningConclusion
Frequently asked questions
Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Machine Learning for Beginners by John Slavio in PDF and/or ePUB format, as well as other popular books in Computer Science & Artificial Intelligence (AI) & Semantics. We have over one million books available in our catalogue for you to explore.
Information
SUPERVISED MACHINE LEARNING ALGORITHMS
Supervised machine learning algorithms are basically machine learning algorithms where you give the machine a helping hand in the beginning. These usually lead to unsupervised machine learning or even reinforced machine learning. Whenever you perform supervised machine learning, you are handing the machine the data sets and setting it up so that they get the right answer almost all the time. Once they get an incorrect answer, you then have to go back and see why it got the incorrect answer. Supervised machine learning is the first stage to almost all forms of machine learning because you have to watch and ensure that what is coming out will be correct or mostly accurate when you don't watch it or help it. This is why we need to change our algorithm to handle large sets of data that will have a helping hand in creating bias. Essentially, what we are going to do here is we are going to hand the machine learning algorithm (that we've partially created) the most biased answer we can possibly give it. However, we first have to rewrite our algorithm to handle years as one chunk of data. It is unlikely that students would have their ethnicity held in one database and their field of study in another database, so we need to change our algorithm to handle a multidimensional array.
var yearOne =[[][][]] var yearTwo =[[][][]] var yearThree =[[][][]] // 1,2,3,4,5,6,7,8,9,10 var commonEthnicity = [0,0,0,0,0,0,0,0,0,0] var commonOrigins = [0,0] var commonStudy = [0,0,0,0,0,0] function machineLearning(year){ var ethnicity = year[0] var origin = year[1] var study = year[2] |
Now that we have set it up to handle multidimensional arrays, we need to create a bias in the data. The usual method for doing this is to make the first data set completely biased, the second data set partially biased, and the last data set with only a slight bias. This gives the machine a starting point and then slowly balances the bias out so that when it hits random numbers, it’s able to possibly make some more accurate guesses. In reality, you would have a large database where you would use testing sets to test your algorithm and once your algorithm showed promise, you would use the testing data instead of the multidimensional arrays we’ll be using here. Then you would use your algorithm on the remaining amount of data to reap the benefits of non-simulated machine learning. Let’s lay some ground rules for our experiment:
- The end of the third testing stage will be a 2, 1, and 4
- Each year will hold 50 students
- The last year will be randomized but also doctored to provide bias.
Now, here is what the first year looks like:
var yearOne =[[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4]] var yearTwo =[[],[],[]] var yearThree =[[],[],[]] |
And this is our result:
It is likely that the next student will be a 2 with a 1 and they will study the field of 4. |
As expected, we have a completely biased answer. Now we need a multidimensional array that’s only partially biased. Let’s say our partial will be 50%. This is what the addition of the second year looks like:
var yearOne =[[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4]] var yearTwo =[[2,2,2,10,2,7,2,5,2,3,2,9,2,10,2,1,2,5,2,3,2,10,2,1,2,10,2,7,2,5,2,8,2,4,2,8,2,4,2,2,2,6,2,6,2,4,2,2,2,4],[2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1],[4,2,4,6,4,5,4,2,4,4,4,6,4,4,4,4,4,2,4,6,4,6,4,6,4,5,4,6,4,4,4,5,4,4,4,2,4,4,4,2,4,4,4,6,4,4,4,5,4,6]] var yearThree =[[],[],[]] |
And this is our result:
It is likely that the next student will be a 2 with a 1 and they will study the field of 4. |
As you can see, our numbers have changed very little in between the years. Now it is time for the last year and only 10% of it will be biased.
var yearOne =[[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4]] var yearTwo =[[2,2,2,10,2,7,2,5,2,3,2,9,2,10,2,1,2,5,2,3,2,10,2,1,2,10,2,7,2,5,2,8,2,4,2,8,2,4,2,2,2,6,2,6,2,4,2,2,2,4],[2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1],[4,2,4,6,4,5,4,2,4,4,4,6,4,4,4,4,4,2,4,6,4,6,4,6,4,5,4,6,4,4,4,5,4,4,4,2,4,4,4,2,4,4,4,6,4,4,4,5,4,6]] var yearThree =[[2,3,6,1,3,2,3,10,7,10,2,8,6,7,8,2,9,3,3,7,2,3,9,6,4,2,3,8,6,8,2,4,7,2,9,2,9,1,9,6,2,4,6,10,4,2,7,10,1,1],[1,2,2,2,1,1,1,2,2,1,1,2,1,1,1,1,1,1,2,2,1,2,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,2,2,2,1],[4,6,4,2,5,4,1,3,6,4,4,4,6,4,2,4,2,6,2,1,4,1,6,3,5,4,4,1,2,2,4,4,6,3,3,4,2,5,6,3,4,2,6,5,6,4,2,6,6,6]] |
And this is our result:
It is likely that the next student will be a 2 with a 1 and they will study the field of 4. |
Alright, so even with a bias of 10%, we can still clearly see that we are getting the results that we want. However, we’re still missing two very important components: Confidence level and Final Test. In order to figure out the confidence level, we need to be able to calculate the percentage of each category and then combine those into a single percentage. Since we chose an easy sample party of 50, this means we just double the number to 100 and the number itself. For instance, if there were 14 1’s out of 50, we would say that there is a 28% confidence there is going to be a 1. Therefore, after some rearranging and rewriting, our code looks like this.
function machineLearning(year){ var ethnicity = year[0] var origin = year[1] var study = year[2] var commonEthReal, commonOrReal, commonStReal; var commonEthPt, commonOrPt, commonStPt; var confidence; var placeholder; var i; for(i = 0; i < ethnicity.length; i++){ commonEthnicity[ethnicity[i] - 1]++ } commonEthPt = Math.max(...commonEthnicity) commonEthReal = commonEthnicity.indexOf(commonEthPt) + 1 for(i = 0; i < origin.length; i++){ commonOrigins[(origin[i] < 2 ? 0 : 1)]++ } commonOrPt = Math.max(...commonOrigins) commonOrReal = commonOrigins.indexOf(commonOrPt) + 1 for(i = 0; i < study.length; i++){ commonStudy[study[i] - 1]++ } commonStPt = Math.max(...commonStudy) commonStReal = commonStudy.indexOf(commonStPt) + 1 confidence = ((commonEthPt + commonOrPt + commonStPt) / 3) placeholder = "It is likely that the next student will be a " + (commonEthReal) + " with a " + (commonOrReal) + " and they will study the field of " + (commonStReal) + ". I am " + confidence + "% sure that this will happen." console.log(placeholder) } |
This looks very nice and now when we run it on the 50% biased year, we receive this:
It is likely that the next student will be a 2 with a 1 and they will study the field of 4. I am 50% sure that this will happen. |
As you can see, the confidence level is exactly 50% sure of this. Let’s see what happens with year 2 and 3.
It is likely that the next student will be a 2 with a 1 and they will study the field of 4. I am 28.666666666666668% sure that this will happen. It is likely that the next student will be a 2 with a 1 and they will study the field of 4. I am 20% sure that this will happen. |
Those are some extremely intriguing results, but we’re still not quite done bec...
Table of contents
- DISCLAIMER
- ABOUT THE AUTHOR
- WHAT IS MACHINE LEARNING?
- IMPORTANCE OF MACHINE LEARNING / APPLICATIONS
- INTRODUCTION TO STATISTICS FOR MACHINE LEARNING
- SUPERVISED MACHINE LEARNING ALGORITHMS
- UNSUPERVISED MACHINE LEARNING ALGORITHMS
- REINFORCED MACHINE LEARNING ALGORITHMS
- CONCLUSION



