Artificial Intelligence, Machine
Learning, Python & Data Science –
Comprehensive Study Notes
1. Artificial Intelligence (AI) Fundamentals
Artificial Intelligence (AI) is the field of computer science focused on creating systems
capable of performing tasks that normally require human intelligence such as reasoning,
learning, perception, language understanding, and decision-making.
Categories of AI:
• Narrow AI – AI designed for a specific task (e.g., Google Maps routing, spam filters).
• General AI – Hypothetical AI capable of performing any intellectual task a human can.
• Super AI – Hypothetical intelligence surpassing human capabilities in all domains.
AI Based on Functionality:
• Reactive Machines – No memory, react only to current inputs.
• Limited Memory – Uses past data to improve decisions (e.g., self-driving cars).
• Theory of Mind – AI that understands human emotions and beliefs (research stage).
• Self-Aware AI – AI with consciousness (theoretical).
2. Relationship Between AI, Machine Learning, and Deep Learning
Artificial Intelligence is the broadest concept.
Machine Learning is a subset of AI that allows systems to learn from data.
Deep Learning is a subset of Machine Learning using neural networks with many layers.
Hierarchy:
Artificial Intelligence → Machine Learning → Deep Learning
3. Machine Learning Fundamentals
Machine Learning enables computers to learn patterns from data and improve performance
without being explicitly programmed.
Main Learning Types:
• Supervised Learning – Uses labeled datasets (inputs and outputs).
• Unsupervised Learning – Finds patterns in unlabeled data.
• Reinforcement Learning – Learns through rewards and penalties.
Typical Machine Learning Workflow:
1. Data Collection
2. Data Cleaning and Preprocessing
3. Feature Engineering
4. Model Selection
5. Model Training
6. Model Evaluation
7. Hyperparameter Tuning
8. Deployment
4. Regression
Regression is used to predict continuous numerical values.
Example applications:
• Housing price prediction
• Sales forecasting
• Predicting weight from height
Linear Regression Model:
Y = b0 + b1X1 + b2X2 + ... + bnXn
Where:
Y = predicted value
b0 = intercept
b1..bn = coefficients
X = features
Evaluation Metrics:
Mean Squared Error (MSE):
MSE = (1/n) Σ (Yi − Ŷi)²
Root Mean Squared Error (RMSE):
RMSE = √MSE
R-squared:
Measures percentage of variance explained by the model.
5. Classification
Classification predicts categorical outcomes.
Examples:
• Spam vs Not Spam email
• Disease diagnosis
• Image category prediction
Common Algorithms:
• Logistic Regression
• Decision Trees
• Random Forest
• Support Vector Machines
Evaluation Metrics:
• Accuracy
• Precision
• Recall
• F1 Score
Confusion Matrix:
Shows True Positive, False Positive, True Negative, False Negative predictions.
6. Clustering (Unsupervised Learning)
Clustering groups similar data points together without labels.
Common Algorithms:
• K-Means Clustering
• Hierarchical Clustering
Applications:
• Customer segmentation
• Market analysis
• Anomaly detection
7. Feature Engineering and Data Preprocessing
Feature Engineering involves transforming raw data into useful features for models.
Common preprocessing techniques:
• Handling missing values (mean/median imputation)
• Encoding categorical variables (One-Hot Encoding)
• Feature scaling (Normalization or Standardization)
Feature Scaling ensures variables are on similar numerical ranges which improves model
performance.
8. Model Training and Evaluation
Train-Test Split:
Dataset is divided into training data and testing data to evaluate performance.
Cross Validation:
K-Fold Cross Validation divides data into K subsets and trains the model multiple times for
better evaluation.
Hyperparameter Tuning:
GridSearchCV searches different parameter combinations to find the best model
configuration.
Pipelines:
Machine learning pipelines automate preprocessing and model training steps in a single
workflow.
9. Neural Networks and Deep Learning
Artificial Neural Networks (ANN) are inspired by the human brain.
Architecture:
• Input Layer
• Hidden Layers
• Output Layer
Hidden layers perform feature extraction and transformations.
Activation Functions introduce non-linearity:
• ReLU
• Sigmoid
• Tanh
• Softmax
Backpropagation is the process of updating weights to minimize error using gradient
descent.
10. Deep Learning Models
Convolutional Neural Networks (CNN):
Used for image recognition and computer vision tasks.
Recurrent Neural Networks (RNN):
Used for sequential data such as text, speech, and time series.
Transformers:
Modern architecture used in NLP that relies on self-attention mechanisms.
Examples: BERT, GPT.
11. Natural Language Processing (NLP)
NLP enables computers to understand and generate human language.
Common NLP tasks:
• Tokenization
• Named Entity Recognition (NER)
• Part-of-Speech (POS) Tagging
• Text classification
• Sentiment analysis
Transformers improved NLP by introducing self-attention and positional encoding.
Libraries: NLTK, SpaCy, HuggingFace Transformers.
12. Python for AI and Machine Learning
Python is the most widely used programming language in AI due to its simplicity and large
ecosystem.
Core Python Concepts:
• Variables
• Data Types (int, float, string, list, dictionary)
• Loops
• Functions
Scientific Python Libraries:
• NumPy – numerical computation
• Pandas – data analysis
• Matplotlib – visualization
• Seaborn – statistical plots
Machine Learning Library:
• Scikit-learn
Deep Learning Libraries:
• TensorFlow
• Keras
• PyTorch
Computer Vision:
• OpenCV
Deployment Frameworks:
• Flask
• FastAPI
13. Data Visualization
Data visualization converts raw data into visual insights using charts and dashboards.
Tools:
• Matplotlib
• Seaborn
• Tableau
• Power BI
Dashboards combine multiple visualizations to help users interactively analyze data.
14. Tableau
Tableau is a data visualization tool used to create interactive dashboards.
Features:
• Drag-and-drop interface
• Data wrangling
• Dashboard creation
• Publishing visualizations online
Common data sources:
• CSV
• Excel
• Databases
15. Power BI
Power BI is a Microsoft Business Intelligence tool used for data analysis and reporting.
Core Components:
• Power BI Desktop
• Power BI Service
• Power BI Mobile
Key Features:
• Data modeling
• Report creation
• Interactive dashboards
Power Query is used for data cleaning and transformation.
DAX (Data Analysis Expressions) is used for calculations.
Example:
Total Revenue = SUM(Sales[Revenue])
Slicers allow users to filter reports interactively.
16. Model Deployment
Once trained, machine learning models are deployed so applications can use them.
Deployment Tools:
• Flask – lightweight web framework
• FastAPI – modern API framework
Models are often saved using:
• Pickle (.pkl)
• Joblib
• TensorFlow SavedModel