Four Machine Learning Techniques Using Python

2020-01-27

Machine Learning Regression


In some statistical books, we often find regression as a measure of the relationship between the mean of a variable and the corresponding values of other variables. So let's discuss how to approach it.


Regression Mean


Charles Darwin's cousin Francis Galton observed the size of several generations of peas. He concluded that natural selection would result in the coexistence of both large and small peas. If we engage in selective breeding, then the size of peas can be controlled. However, if we let peas reproduce naturally, even larger peas will produce smaller offspring over time. For peas, they have a certain size, but these values can be mapped to specific lines or curves.


Another Example: Monkeys and Stocks


In 1973, Princeton University professor Burton Malkiel proposed his own claim in the bestselling book "A Random Walk Down Wall Street" and insisted that a blindfolded monkey could choose investment portfolios like throwing darts. In this type of stock-picking contest, the monkey outperformed the experts. But this is just a rare event, and if there are enough occurrences, the accuracy of the monkey will decrease until it regresses to the mean.



What is Machine Learning Regression?


In this graph, the red line best fits all the data points marked. Using this line, we can predict what value can be found at x = 70 (with some degree of uncertainty).As a machine learning technique, regression has found its foundation in supervised learning. We use it to predict a continuous numerical target and start from processing the values we already know. It compares known values with predicted values and marks the difference between expected and predicted values as errors/residuals.


Types of Regression in Machine Learning


We usually observe two types of regression:


  • Linear Regression: When we can represent the relationship between the target and predictor variables with a straight line, we use linear regression, such as: y = P1x + P2 + e
  • Nonlinear Regression: When we observe a nonlinear relationship between the target and predictor variables, we cannot represent it as a straight line.

Machine Learning Classification


What is Machine Learning Classification?


Classification is a data mining technique that allows us to predict the membership of data instances. This is done using pre-labeled data and belongs to supervised learning. This means we train the data and expect to predict its future. The term "prediction" refers to classifying the data into the categories they can belong to. We have two available attributes:


  • Output attribute or dependent attribute.
  • Input attribute or independent attribute.

Classification Methods


  • Decision Tree Induction: We construct a decision tree from classes labeled as tuples. It has internal nodes, branches, and leaf nodes. Internal nodes represent tests on attributes, branches represent test results, leaf nodes represent class labels. The two steps involved are learning and testing, and it is fast.
  • Rule-Based Classification: This classification is based on a set of IF-THEN rules. Rules are represented as: If condition then conclusion
  • Classification through Backpropagation: Neural network learning (often called connectionist learning) builds connections. Backpropagation is the most popular neural network learning algorithm. It iteratively processes data and compares target values with results to learn.
  • Lazy Learners: In lazy learner approaches, the machine stores training tuples and waits for test tuples. This supports incremental learning. This contrasts with eager learner approaches.

ML Classification Example


Let's take an example. Considering that we teach you various codes here. We show you ITF barcodes, Code 93 barcodes, QR codes, Aztecs, and data matrices. After going through most of the examples, now it's time for us to determine the type of code when we show you the code. This is supervised learning, and we use a part of two examples - training and testing.


Please note how certain stars of each shape eventually appear on the other side of the curve.


Clustering


Clustering is unsupervised classification. It is an exploratory data analysis without available labeled data. Through clustering, we divide unlabeled data into naturally and hidden finite and discrete sets of data structures. We observe two types of clustering:


  • Hard Clustering: An object belongs to one cluster.
  • Soft Clustering: An object may belong to multiple clusters.

In clustering, we first select features, then design clustering algorithms, then validate the clustering. Finally, we interpret the results.


Example



Reviewing the above example. You can group these codes together. QR codes, Aztec, and Data Matrix will be in one group; we can call it the "2D codes." ITF barcodes and Code 39 barcodes will fall into the category of "1D codes."


Outlier Detection


An outlier is something that deviates from the expected process. Sometimes, with the help of machine learning, we may want to discover an outlier. For example, checking doctor bills every hour and totaling 42 seconds per patient. Another way is to find a specific dentist bill only on a certain day. This situation raises suspicion, and outlier detection is a good way to highlight these anomalies because it is not something we are specifically looking for.

RECENT AI NEWS

RECENT AI TOOLS