Machine Learning Notes
Machine Learning Notes
Definition:
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.
The study of Machine Learning focuses on designing and analyzing algorithms that improve their
performance at a given task with experience or data.
Importance of Machine Learning :
• Automation and Adaptability in Machine Learning
ML enables automation by performing tasks without human intervention and adaptability by learning
from new data and adjusting to changes. This makes ML systems efficient, self-improving, and
essential in fields like finance, healthcare, and automation.
• Pattern Recognition in Machine Learning
Pattern recognition enables ML systems to identify trends, structures, and regularities in data to make
predictions and decisions. It is widely used in image recognition, finance, natural language processing,
fraud detection, and medical diagnosis.
• Handling Complex Problems with ML
ML solves complex, data-heavy problems by recognizing patterns and making adaptive decisions. It
excels in medical diagnosis, self-driving cars, and financial forecasting, where traditional methods fall
short.
• Scientific Discovery
ML accelerates scientific discovery by analyzing vast data, identifying patterns, and automating
research. It aids in drug discovery, astronomy, genetics, and climate science, making breakthroughs
faster and more efficient.
• Economic and Industrial Impact
ML drives economic growth and industrial innovation by optimizing processes, reducing costs, and
increasing efficiency. It powers automation, predictive maintenance, supply chain optimization, and
personalized marketing, transforming industries like manufacturing, finance, and healthcare.
• Data-Driven Decision Making
ML enhances decision-making by analyzing vast data, identifying patterns, and providing actionable
insights. It improves business strategy, healthcare diagnostics, financial forecasting, and risk
management, enabling smarter, evidence-based choices.
• Uncertainty Handling in Machine Learning
ML manages uncertainty by using probabilistic models, fuzzy logic, and Bayesian networks to make
reliable predictions despite incomplete or noisy data. This is crucial in risk assessment, medical
diagnosis, and financial forecasting, ensuring robust decision-making.
• Interdisciplinary Applications of Machine Learning
ML integrates with various fields like healthcare, finance, physics, and social sciences, solving complex
problems through data analysis, automation, and predictive modeling.
• Foundation for Artificial Intelligence
ML is the core of AI, enabling systems to learn, adapt, and make decisions without explicit
programming. It powers computer vision, natural language processing, robotics, and autonomous
systems, making AI more intelligent and capable.
Tensorflow:
TensorFlow is an open-source machine learning framework developed by Google Brain. It is widely
used for deep learning, artificial intelligence, and large-scale ML applications. TensorFlow enables
developers to build, train, and deploy models across various platforms, including cloud, mobile, and
edge devices.
2. Key Features
• Scalability → Supports multi-GPU, TPU, and distributed computing for large-scale training
• Flexible Architecture → Works for deep learning, reinforcement learning, and traditional ML.
• Keras Integration → Provides an easy-to-use high-level API for rapid model development.
3. Drawbacks:
• Debugging Challenges → Static computation graph makes debugging harder than PyTorch.
• Performance Overhead → Heavier memory usage compared to some lightweight frameworks.
Unsupervised Learning:
The model finds patterns in unlabeled data without predefined outputs.
Example:
Customer Segmentation → Groups customers based on purchasing behavior.
Anomaly Detection → Detects fraud in financial transactions.
Types:
Clustering: Groups similar data points (e.g., customer segmentation).
Dimensionality Reduction: Reduces data complexity while preserving important features (e.g., PCA for
image compression).
Algorithms: K-Means Clustering, PCA
Reinforcement Learning:
The model interacts with an environment, receiving rewards or penalties to learn optimal actions.
Example:
Game AI: AlphaGo and Chess-playing AI.
Robotics: Learning navigation in complex environments.
Types:
Model-Free RL: Learns directly from experience (e.g., Q-learning).
Model-Based RL: Builds a model of the environment before making decisions (e.g., Dynamic
Programming).
Algorithms: Q-Learning, Deep Q Networks (DQN)
learning:
o Data Formatting: Standardizing the structure of data.
Decision Tree
A Decision Tree is a popular machine learning algorithm used for both classification and
regression tasks. It is structured like a tree, where each node represents a decision based
on a feature, and the final outcomes (leaf nodes) represent predictions.
1. Decision Tree Basics
A decision tree consists of:
• Nodes: Represent decisions or outcomes.
• Root Node: The first node that represents the starting decision.
• Leaf Nodes: Final nodes that represent the output (class label or numerical value).
Example:
Root Node
/ \
Decision 1 Decision 2
/ \ / \
Leaf1 Leaf2 Leaf3 Leaf4
Each path from the root to a leaf represents a classification rule.
o Example: Predicting house prices based on features like area and number of
rooms.
Where:
• S = dataset
Example:
If we have 10 samples:
• 6 are Yes (Positive)
• 4 are No (Negative)
Entropy is:
Entropy increases as the data becomes more mixed and decreases when it is more
uniform.
Where:
• IG(S,A) = Information gain when splitting on attribute A
Example:
Let's say we split data based on "Weather" (Sunny, Rainy, Overcast). If splitting reduces
entropy from 0.971 to 0.4, then:
IG=0.971−0.4=0.571
Since information gain is high, "Weather" is a good feature to split on.