Report
Report
Machine Learning
Machine learning (ML) is the study of computer algorithms that improve automatically through
experience and by the use of data. It is seen as a part of artificial intelligence. Machine learning
algorithms build a model based on sample data, known as "training data", in order to make predictions or
decisions without being explicitly programmed to do so. Machine learning algorithms are used in a wide
variety of applications, such as in medicine, email filtering, and computer vision, where it is difficult or
unfeasible to develop conventional algorithms to perform the needed tasks.
A subset of machine learning is closely related to computational statistics, which focuses on making
predictions using computers; but not all machine learning is statistical learning. The study of mathematical
optimization delivers methods, theory and application domains to the field of machine learning. Data
mining is a related field of study, focusing on exploratory data analysis through unsupervised learning. In
its application across business problems, machine learning is also referred to as predictive analytics.
Machine learning plays an important role in cybersecurity and online fraud detection. Because of growing
monetary online frauds, companies like PayPal have started using machine learning techniques for
protection against the money laundering. The prediction problem of the model for fraud detection can be
divided into two types: classification and regression. Some of the most used machine learning approaches
for this type of prediction problems are Logistic Regression, Decision Tree, Random Forest Tree, and
Neural Networks.
Modern day machine learning has two objectives, one is to classify data based on models which have
been developed, the other purpose is to make predictions for future outcomes based on these models. A
hypothetical algorithm specific to classifying data may use computer vision of moles coupled with
supervised learning in order to train it to classify the cancerous moles. Where as machine learning
algorithm for stock trading may inform the trader of future potential predictions
Machine Learning is the field of study that gives computers the capability to learn without being
explicitly programmed. ML is one of the most exciting technologies that one would have ever come
across. As it is evident from the name, it gives the computer that makes it more similar to humans: The
ability to learn. Machine learning is actively being used today, perhaps in many more places than one
would expect.
A subset of machine learning is closely related to computational statistics, which focuses on making
predictions using computers; but not all machine learning is statistical learning. The study of
mathematical optimization delivers methods, theory and application domains to the field of machine
learning. Data mining is a related field of study, focusing on exploratory data analysis through
unsupervised learning. In its application across business problems, machine learning is also referred to as
predictive analytics
Machine learning involves computers discovering how they can perform tasks without being explicitly
programmed to do so. It involves computers learning from data provided so that they carry out certain
tasks. For simple tasks assigned to computers, it is possible to program algorithms telling the machine
how to execute all steps required to solve the problem at hand; on the computer's part, no learning is
needed.
The machine learning field is continuously evolving. And along with evolution comes a rise in demand
and importance. There is one crucial reason why data scientists need machine learning, and that is: ‘High-
value predictions that can guide better decisions and smart actions in real-time without human
intervention.
Machine learning as technology helps analyze large chunks of data, easing the tasks of data scientists in
an automated process and is gaining a lot of prominence and recognition. Machine learning has changed
the way data extraction and interpretation works by involving automatic sets of generic methods that
have replaced traditional statistical techniques.
For more advanced tasks, it can be challenging for a human to manually create the needed algorithms. In
practice, it can turn out to be more effective to help the machine develop its own algorithm, rather than
having human programmers
Machine learning architecture
Machine Learning approaches :
Machine learning approaches are traditionally divided into three broad categories,
depending on the nature of the "signal" or "feedback" available to the learning system
Supervised learning
algorithm analyses the training data(set of training examples) and produces a correct outcome
Supervised learning is where there are input variables (x) and an output variable (Y) and an
algorithm is used to learn the mapping function from the input to the output.
Y = f(X)
The goal is to approximate the mapping function so well that when there is a new
input data (x) that the output variables (Y) for that data can be predicted easily
Supervised learning flowchart
Unsupervised learning
Unsupervised learning algorithms take a set of data that contains only inputs, and find structure in the
data, like grouping or clustering of data points. The algorithms, therefore, learn from test data that has
not been labeled, classified or categorized. Instead of responding to feedback, unsupervised learning
algorithms identify commonalities in the data and react based on the presence or absence of such
commonalities in each new piece of data. A central application of unsupervised learning is in the field
of density estimation in statistics, such as finding the probability density function. Though
unsupervised learning encompasses other domains involving summarizing and explaining data
features.
Unsupervised learning is the training of machine using information that is neither classified nor
labeled and allowing the algorithm to act on that information without guidance. Here the task of
machine is to group unsorted information according to similarities, patterns and differences without
any prior training of data. Unlike supervised learning, no teacher is provided that means no training
will be given to the machine. Therefore, machine is restricted to find the hidden structure in
unlabeled data by itself.
Unsupervised learning flowchart
Semi-supervised Learning
Semi-supervised learning falls between unsupervised learning (without any labeled training
data) and supervised learning (with completely labeled training data). Some of the training examples
are missing training labels, yet many machine-learning researchers have found that unlabeled data,
when used in conjunction with a small amount of labeled data, can produce a considerable
improvement in learning accuracy.
Reinforcement learning
Reinforcement learning is an area of machine learning concerned with how software agents
ought to take actions in an environment so as to maximize some notion of cumulativereward. Due to
its generality, the field is studied in many other disciplines, such as gametheory, control theory,
operations research, information theory, simulation-based optimization, multi-agent
systems, swarm intelligence, statistics and genetic algorithms. In machine learning, the environment
is typically represented as a Markov decision process (MDP).
Many reinforcement learning algorithms use dynamic programming techniques. Reinforcement
learning algorithms do not assume knowledge of an exact mathematical model of the MDP, and are
used when exact models are infeasible. Reinforcement learning algorithms are used in autonomous
vehicles or in learning to play a game against a human opponent.
A computer program interacts with a dynamic environment in which it must perform a certain goal.
As it navigates its problem space, the program is provided feedback that's analogous to rewards,
which it tries to maximize.
Feature Learning
Several learning algorithms aim at discovering better representations of the inputs provided during
training. Classic examples include principal components analysis and cluster analysis. Feature
learning algorithms, also called representation learning algorithms, often attempt to preserve the
information in their input but also transform it in a way that makes it useful, often as a pre-processing
step before performing classification or predictions. This technique allows reconstruction of the
inputs coming from the unknown data-generating distribution, while not being necessarily faithful to
configurations that are implausible underthat distribution. This replaces manual feature engineering,
and allows a machine to both learn the features and use them to perform a specific task.
Feature learning can be either supervised or unsupervised. In supervised feature learning, features are
learned using labeled input data. Examples include artificial neural networks, multilayer perceptrons,
and supervised dictionary learning. In unsupervised feature learning, features are learned with
unlabeled input data. Examples include dictionary learning, independent component analysis,
autoencoders, matrix factorization and various forms of clustering
Manifold learning algorithms attempt to do so under the constraint that the learned representation is
low-dimensional. Sparse coding algorithms attempt to do so under the constraint that the learned
representation is sparse, meaning that the mathematical model has many zeros. Multilinear subspace
learning algorithms aim to learn low-dimensional representations directly from tensor representations
for multidimensional data, without reshaping them into higher-dimensional vectors. Deep learning
algorithms discover multiple levels of representation, or a hierarchy of features, with higher-level,
more abstract features defined in terms of (or generating) lower-level features. It has been argued that
an intelligent machine is one that learns a representation that disentangles the underlying factors of
variation that explain the observed data.
Feature learning is motivated by the fact that machine learning tasks such as classification often
require input that is mathematically and computationally convenient to process. However, real-world
data such as images, video, and sensory data has not yielded to attempts to algorithmically define
specific features. An alternative is to discover such features or representations through examination,
without relying on explicit algorithms.
ALGORITHMS:
CLASSIFICATION VS REGRESSION
CLASSIFICATION :
Classification allows you to divide a given input into some pre-defined categories. The output is a
discrete value, i.e., distinct, like 0/1, True/False, or a pre-defined output label class.
Simply put, classification is the process of segregating or classifying objects. It is a type of supervised
learning method where input data is usually classified into output classes. It provides a mapping
function to convert input values into known, discrete output classes. It can have multiple inputs and
gives multiple outputs.
The diagram below clearly explains classification. Given a list of grocery items, you can separate them
into different categories like vegetables, fruits, dairy products, groceries, etc., using classification.
Classification Algorithm
Based on training data, the Classification algorithm is a Supervised Learning technique used to
categorize new observations. In classification, a program uses the dataset or observations provided
to learn how to categorize new observations into various classes or groups. he Classification
algorithm uses labeled input data because it is a supervised learning technique and comprises input
and output information. A discrete output function (y) is transferred to an input variable in the
classification process (x).
The main goal of the Classification algorithm is to identify the category of a given dataset, and
these algorithms are mainly used to predict the output for the categorical data.
Classification algorithms can be better understood using the below diagram. In the below
diagram, there are two classes, class A and Class B. These classes have features that are similar to
each other and dissimilar to other classes.
Types of ML Classification Algorithms:
Classification Algorithms can be further divided into the Mainly two category:
o Linear Models
o Logistic Regression
o Non-linear Models
o K-Nearest Neighbours
REGRESSION:
Regression in machine learning is a technique used to capture the relationships between independent
and dependent variables, with the main purpose of predicting an outcome. It involves training a set of
algorithms to reveal patterns that characterize the distribution of each data point. With patterns
identified, the model can then make accurate predictions for new data points or input values.
Different regression techniques:
1. Linear Regression
2. Logistic Regression
3. Polynomial Regression
1. Linear Regression
Linear regression is a statistical model used to predict the relationship between independent and
dependent variables by examining two factors:
Independent Variable
The value of an independent variable does not change based on the effects of other variables. An
independent variable is used to manipulate the dependent variable. It is often denoted by an “x.” In our
example, the rainfall is the independent variable because we can’t control the rain, but the rain controls
the crop—the independent variable controls the dependent variable.
Dependent Variable
The value of this variable changes when there is any change in the values of the independent variables,
as mentioned before. It is often denoted by a “y.” In our example, the crop yield is the dependent
variable, and it is dependent on the amount of rainfall.
Regression Equation
The simplest linear regression equation with one dependent variable and one independent variable is:
y = m*x + c
Graph:
2. Logistic Regression
Logistic regression is a statistical method that is used for building machine learning models where the
dependent variable is dichotomous: i.e. binary. Logistic regression is used to describe data and the
relationship between one dependent variable and one or more independent variables. The independent
variables can be nominal, ordinal, or of interval type.
The name “logistic regression” is derived from the concept of the logistic function that it uses. The
logistic function is also known as the sigmoid function. The value of this logistic function lies between
zero and one.
The following is an example of a logistic function we can use to find the probability of a vehicle
breaking down, depending on how many years it has been since it was serviced last.
Here is how you can interpret the results from the graph to decide whether the vehicle will break
down or not.
3. Polynomial Regression
Polynomial Regression is another one of the types of regression analysis techniques in machine
learning, which is the same as Multiple Linear Regression with a little modification. In Polynomial
Regression, the relationship between independent and dependent variables, that is X and Y, is
denoted by the n-th degree.
It is a linear model as an estimator. Least Mean Squared Method is used in Polynomial Regression
also. The best fit line in Polynomial Regression that passes through all the data points is not a straight
line, but a curved line, which depends upon the power of X or value of n.
COMPARISON BETWEEN ALGORITHMS:
1) SVM: The support vector machine algorithm's goal is to find a hyperplane in an N-dimensional space
(N — the number of features) that categorizes data points clearly.
There are several different hyperplanes that could be used to distinguish the two types of data points (as
seen in fig 4.9). Our aim is to find a plane with the greatest margin, or the greatest distance between
data points from both groups. Maximizing the margin gap provides some reinforcement, making it easier
to classify potential data points. Hyperplanes are decision boundaries that aid in data classification.
Different groups may be assigned to data points on either side of the hyperplane. The
hyperplane's dimension is also determined by the number of functions. If there are only two input
features, the hyperplane is just a line. The hyperplane becomes a two-dimensional plane when
the number of input features reaches three. When the number of features reaches three, it becomes
impossible to picture
SOFTWARE DESCRIPTION
Jupyter notebook
In this case, "notebook" or "notebook documents" denote documents that contain both code and rich
text elements, such as figures, links, equations, ... Because of the mix of code and text elements, these
documents are the ideal place to bring together an analysis description, and its results, as well as, they can be
executed perform the data analysis in real time.
At some point, we all need to show our work. Most programming work is shared either
as raw source code or as a co mpiled executable. The source code provides complete information, but in a way
that’s more “tell” than “show.” The executable shows us what the software does, but even when shipped with
the source code it can be difficult to grasp exactly how it works.
A notebook integrates code and its output into a single document that combines visualizations,
narrative text, mathematical equations, and other rich media. In other words: it's a single document where you
can run code, display the output, and also add explanations, formulas, charts, and make your work more
transparent, understandable, repeatable, and shareable.
Using Notebooks is now a major part of the data science workflow at companies across
the globe. If your goal is to work with data, using a Notebook will speed up your workflow and make it
easier to communicate and share your results.
Imagine being able to view the code and execute it in the same UI, so that you could
make changes to the code and view the results of those changes instantly, in real time? That’s just what
Jupyter Notebook offers.
Jupyter Notebook was created to make it easier to show one’s programming work, and to let others
join in. Jupyter Notebook allows you to combine code, comments, multimedia, and visualizations in an
interactive document — called a notebook, naturally — that can be shared, re-used, and re-worked.
And because Jupyter Notebook runs via a web browser, the notebook itself could be hosted on your
local machine or on a remote server
One major feature of the Jupyter notebook is the ability to display plots that are the output of running
code cells. The IPython kernel is designed to work seamlessly with the matplotlib plotting library
to provide this functionality. Specific plotting library
integration is a feature of the kernel..
Each .ipynb file is one notebook, so each time you create a new notebook, a new .ipynb file will
be created.
Each .ipynb file is a text file that describes the contents of your notebook in a format called JSON.
Each cell and its contents, including image attachments that have been converted into strings of text, is listed
therein along with some metadata.
Jupyter Notebooks are a powerful way to write and iterate on your Python code for data analysis. Rather than
writing and re-writing an entire program, you can write lines of code and run them one at a time. Then, if you
need to make a change, you can go back and make your edit and rerun the program again, all in the same
window.
Jupyter Notebook is built off of IPython, an interactive way of running Python code in
the terminal using the REPL model (Read-Eval-Print-Loop). The IPython Kernel runs the computations and
communicates with the Jupyter Notebook front-end interface. It also allows Jupyter Notebook to support
multiple languages. Jupyter Notebooks extend IPython through
additional features, like storing your code and output and allowing you to keep markdown
notes.
Jupyter Notebook provides you with an easy-to-use, interactive data science environment
across many programming languages that doesn't only work as an IDE, but also as a presentation or
education tool.
5.2 Python
Python is designed to be highly readable. It uses English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other languages.
Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile
your program before executing it. This is similar to PERL and PHP.
Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter
directly to write your programs.
Python is a Beginner's Language − Python is a great language for the beginner-level programmers
and supports the development of a wide range of applications from simple text processing to WWW browsers
to games.
In this project python is used as programming language.
Python is relatively simple, so it's easy to learn since it requires a unique syntax that focuses on readability.
Developers can read and translate Python code much easier than other
languages. In turn, this reduces the cost of program maintenance and development because it
allows teams to work collaboratively without significant language and experience barriers. Additionally,
Python supports the use of modules and packages, which means that
programs can be designed in a modular style and code can be reused across a variety of projects. Once you've
developed a module or package you need, it can be scaled for use in other projects, and it's easy to import or
export these modules.
One of the most promising benefits of Python is that both the standard library and the interpreter are
available free of charge, in both binary and source form. There is no exclusivity either, as Python and all the
necessary tools are available on all major platforms. Therefore, it is an enticing option for developers who
don't want to worry about paying high development costs.
If this description of Python over your head, don't worry. You'll understand it soon enough. What you
need to take away from this section is that Python is a programming language used to develop software on the
web and in app form, including mobile. It's relatively easy to learn, and the necessary tools are available to all
free of charge.
import pandas as pd
import pandas as pd. Simply imports the library that current namespace, but rather than using the name pandas
, it's instructed to use the name pd instead. This is just so you can do pd. whatever instead of having to type
out pandas. whatever all the time if you just do import pandas.
import numpy as np
NumPy is an open-source numerical Python library. NumPy contains a multi-dimensional array and matrix
data structures. It can be utilised to perform a number of mathematical operations on arrays such as
trigonometric, statistical, and algebraic routines. NumPy is an extension of Numeric and Numarray.
import Random
import random imports the random module, which contains a variety of things to do with random number
generation. Among these is the random() function, which generates random numbers between 0 and 1.
Pyplot is a collection of functions in the popular visualization package Matplotlib. Its functions manipulate
elements of a figure, such as creating a figure, creating a plotting area, plotting lines, adding plot labels, etc.
Seaborn helps you explore and understand your data. Its plotting functions operate on dataframes and arrays
containing whole datasets and internally perform the necessary semantic mapping and statistical aggregation
to produce informative plots. Its dataset-oriented, declarative API lets you focus on what the different elements
of your plots mean, rather than on the details of how to draw them.
Sklearn
Scikit-learn (Sklearn) is the most useful and robust library for machine learning in Python. It provides a
selection of efficient tools for machine learning and statistical modeling including classification, regression,
clustering and dimensionality reduction via a consistence interface in Python. It is a free software machine
learning library for the Python programming language.
sklearn.metrics
Classification metrics. The sklearn. metrics module implements several loss, score, and utility functions to
measure classification performance. Some metrics might require probability estimates of the positive class,
confidence values, or binary decisions values. import roc_curve
ROC curves typically feature true positive rate on the Y axis, and false positive rate on the X axis. This means
that the top left corner of the plot is the “ideal” point - a false positive rate of zero, and a true positive rate of
one. This is not very realistic, but it does mean that a larger area under the curve (AUC) is usually better.
The steepness of ROC curves is also important, since it is ideal to maximize the true positive
ROC curves are typically used in binary classification to study the output of a classifier. In
order to extend ROC curve and ROC area to multi-label classification, it is necessary to binarize the output.
One ROC curve can be drawn per label, but one can also draw a ROC curve by considering each element of
the label indicator matrix as a binary prediction.
TEST PROCEDURE:
Testing is performed to identify errors. It is used for quality assurance. Testing is an integral part of the entire
development and maintenance process. The goal of the testing during phase is to verify that the specification
has been accurately and completely incorporated into the design, as well as to ensure the correctness of the
design itself. For example, the design must not have any logic faults in it. If it is not detected before coding
commences, the cost of fixing the faults will be considerably higher as reflected. Detection of design faults
can be achieved by means of inspection as well as walkthrough. Testing is one of the important steps in the
software development phase.
Manual Testing is a type of software testing in which test cases are executed manually by a tester without
using any automated tools. The purpose of Manual Testing is to identify the bugs, issues, and defects in the
software application. Manual software testing is the most primitive technique of all testing types and it helps
to find critical bugs in the software application.
Any new application must be manually tested before its testing can be automated. Manual Software Testing
requires more effort but is necessary to check automation feasibility. Manual Testing concepts does not require
knowledge of any testing tool.
Object Detection
There are various techniques used in object detection, including region-based methods (like R-
CNN), single-shot methods (like YOLO), and anchor-based methods (like SSD).
Applications of Object Detection:
Object detection has wide-ranging applications, from self-driving cars and
surveillance systems to medical imaging and augmented reality. It plays a crucial role
in enabling machines to perceive and understand the world.
2) YOLO (You Only Look Once): YOLO is a real-time object detection system that
achieves high detection accuracy with impressive speed. It's known for its efficiency and has
become a popular choice for many applications.
3) Mask R-CNN: Mask R-CNN is an extension of the Faster R-CNN framework that adds
pixel-level instance segmentation to object detection. It's widely used for tasks that require
precise object boundaries.
YOLO
YOLO (You Only Look Once) is a state-of-the-art object detection system that uses deep
learning to detect and recognize objects. It can detect multiple objects in real time with high
accuracy, making it a popular tool in computer vision and artificial intelligence. By training
YOLO on tree images, we can teach it to identify different types of trees.
Before we can use YOLO to detect trees, we need to create a dataset of labeled tree images.
This involves collecting images of trees from different angles and lighting conditions, and
labeling them with bounding boxes. With a large and diverse dataset, YOLO can learn to
detect trees under different conditions.
How YOLO Detects Objects?
YOLO divides an input image into an S × S grid. If the center of an object falls into a
grid cell, that grid cell is responsible for detecting that object.
Each grid cell predicts B bounding boxes and confidence scores for those boxes.
These confidence scores reflect how confident the model is that the box contains an
object and how accurate it thinks the predicted box is.
For each bounding box, there are 5 predictions: x, y, w, h,confidence.
YOLO predicts multiple bounding boxes per grid cell. At training time, we only want
one bounding box predictor to be responsible for each object. YOLO assigns one
predictor to be “responsible” for predicting an object based on which prediction has the
highest current IOU with the ground truth.
With our preprocessed dataset, we can now train our YOLO model to detect trees. This
involves feeding the labeled images into the neural network and adjusting the weights to
minimize the detection error. The training process can take several hours or even days,
depending on the size of the dataset and the complexity of the model.
After training, we need to evaluate the performance of our model. This involves measuring the
precision and recall of the detection results, as well as calculating the mean average precision
(mAP). A high mAP indicates that our model can detect trees accurately and consistently
With a trained and evaluated YOLO model, we can now apply it to detect trees in real-world
scenarios. For example, we can use drones equipped with cameras to capture images of forests
and run them through our YOLO model to detect trees. This can help us monitor deforestation
and protect our environment.
Data Analysis in Tree Detection Model
Data Collection
Explore the different sources of Learn about the diverse types of data Discover the common challenges faced durin
data used in tree detection models, collected, such as spectral data, resolution, and data quality.
including satellite imagery, aerial spatial data, and contextual data, to
surveys, and ground-based sensors. enhance tree detection accuracy..
Data Analysis
Continuous data analysis and model refinement: Iteratively improving your object
detection models through analysis-based retraining is essential for achieving high accuracy.