Machine Learning Basics Study Guide
1. What is Machine Learning?
Machine Learning (ML) is a subset of artificial intelligence (AI) that allows systems to
automatically learn and improve from experience without being explicitly programmed. It
involves training a model on data to make predictions or decisions based on new, unseen data.
2. Types of Machine Learning
There are three main types of machine learning:
a. Supervised Learning:
Definition: The model is trained on labeled data, meaning the input data comes with
known output labels.
Objective: Learn the mapping between input and output.
Example: Spam email classification (emails are labeled as "spam" or "not spam").
Algorithms: Linear Regression, Logistic Regression, Support Vector Machines (SVM),
k-Nearest Neighbors (k-NN), Decision Trees, Random Forests.
b. Unsupervised Learning:
Definition: The model is trained on unlabeled data, and the system tries to find hidden
patterns in the data.
Objective: Discover the structure of the data, such as grouping or clustering.
Example: Customer segmentation in marketing (grouping customers based on
purchasing behavior).
Algorithms: K-means clustering, Hierarchical Clustering, Principal Component Analysis
(PCA).
c. Reinforcement Learning:
Definition: The model learns by interacting with an environment and receiving feedback
in the form of rewards or punishments.
Objective: Maximize the cumulative reward over time.
Example: Training a robot to walk or playing video games.
Algorithms: Q-Learning, Deep Q-Networks (DQN), Policy Gradient Methods.
3. Key Concepts
a. Features and Labels:
Features (Inputs): Variables that provide information to the model (e.g., age, income,
height).
Labels (Outputs): The outcome we are trying to predict or classify (e.g., "buy" or "not
buy").
b. Model:
A mathematical or computational representation of a process that makes predictions
based on input data.
c. Training and Testing Data:
Training Data: The dataset used to train the model.
Testing Data: The dataset used to evaluate the model's performance.
d. Overfitting and Underfitting:
Overfitting: The model performs well on training data but poorly on testing data,
because it has memorized the training data instead of learning general patterns.
Underfitting: The model is too simple and cannot capture the underlying patterns in the
data.
e. Bias-Variance Tradeoff:
Bias: The error introduced by approximating a real-world problem by a simplified model.
Variance: The error introduced by the model’s sensitivity to small fluctuations in the
training data.
4. Common Algorithms
Linear Regression: Predicts a continuous output variable based on a linear relationship
between the input features.
Logistic Regression: Used for binary classification tasks; outputs probabilities.
Decision Trees: Splits data based on features to make predictions.
Random Forests: An ensemble method that combines multiple decision trees for
improved accuracy.
k-Nearest Neighbors (k-NN): Classifies data points based on the majority class of the
nearest neighbors.
Support Vector Machines (SVM): Finds the hyperplane that best separates data into
classes.
Neural Networks: Inspired by the human brain, used for complex tasks like image
recognition and language processing.
5. Evaluation Metrics
Accuracy: The proportion of correctly predicted instances to the total instances.
Precision: The proportion of true positive predictions to the total predicted positives.
Recall (Sensitivity): The proportion of true positive predictions to the total actual
positives.
F1-Score: The harmonic mean of precision and recall, useful when there is an uneven
class distribution.
ROC Curve (Receiver Operating Characteristic Curve): Visualizes the tradeoff
between true positive rate and false positive rate.
6. Common Challenges in Machine Learning
Data Quality: Machine learning models rely on clean, high-quality data. Issues like
missing values, noise, and bias can affect model performance.
Feature Engineering: Identifying the right features (variables) to include in the model is
critical for success.
Model Selection: Choosing the right algorithm for the problem based on the type of
data, task, and computational resources.
Scaling: Ensuring that models can handle large datasets or real-time predictions
efficiently.
7. Tools and Libraries
Programming Languages: Python, R
Libraries for ML:
o
Scikit-learn: General-purpose ML library in Python.
o
TensorFlow / Keras: Deep learning frameworks.
o
PyTorch: Another deep learning framework, popular for research.
o
Pandas: For data manipulation and analysis.
o
NumPy: For numerical operations.
o
Matplotlib / Seaborn: For data visualization.
8. Real-World Applications
Image Recognition: Facial recognition, medical image analysis, object detection.
Natural Language Processing (NLP): Sentiment analysis, language translation,
chatbots.
Recommender Systems: Product recommendations on e-commerce websites, movie
suggestions on streaming platforms.
Autonomous Vehicles: Self-driving cars use machine learning for perception, decisionmaking, and control.
9. Steps in a Typical Machine Learning Project
1. Data Collection: Gather relevant data.
2. Data Preprocessing: Clean the data (handling missing values, normalization, etc.).
3. Feature Selection/Engineering: Select and create useful features.
4. Model Selection: Choose the algorithm to train the model.
5. Training: Fit the model to the training data.
6. Evaluation: Assess model performance using testing data.
7. Tuning: Adjust parameters (hyperparameter tuning) to optimize performance.
8. Deployment: Deploy the model to production (in applications or systems).