Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MachineLearning-Beginner Lab Tutorials

This repository contains a series of beginner-friendly machine learning lab notebooks and datasets, designed to guide you step by step from basic probability and linear algebra concepts to implementing and evaluating real machine learning algorithms.

The labs are written in Jupyter Notebooks (.ipynb) and use popular Python libraries such as numpy, pandas, matplotlib, and scikit-learn. Each lab focuses on a small, concrete set of ideas with code you can read, modify, and extend on your own.


1. Repository Structure

1.1 Lab Notebooks

The core of this repo is a sequence of lab notebooks:

  • i210277_TALHA_LAB_02.ipynb

    • Works with a small medical diagnosis example (patients with Positive/Negative labels).
    • Focuses on classification performance metrics such as:
      • True Positive (TP), True Negative (TN), False Positive (FP), False Negative (FN)
      • How to compute counts of TP/TN/FP/FN from predicted vs. actual labels
      • The intuition behind these values for evaluating classifiers
  • i210277_TALHA_LAB_03.ipynb and i210277_TALHA_LAB_03_Bpart.ipynb

    • Uses a student exam dataset with variables like Gender, StudyMethod, and ExamResult.
    • Focuses on categorical data analysis:
      • Constructing contingency tables (cross-tabulations) between two categorical variables
      • Counting and summarizing how categories relate to each other
      • Lays groundwork for understanding probabilities and associations in data
  • i210277_TALHA_04.ipynb

    • Introduces key linear algebra concepts used in ML:
      • Vectors and dot products
      • Computing the projection of one vector onto another
    • Builds intuition for geometric ideas behind many ML algorithms (e.g., distances, directions, and components).
  • i210277_TALHA_LAB_05.ipynb

    • Uses the dataset student_performance.csv.
    • Focuses on data exploration with pandas:
      • Reading CSV files with pandas.read_csv
      • Inspecting dataframes (head, info, describe)
      • Understanding columns and basic descriptive statistics
    • Helps you become comfortable loading and inspecting real-world tabular data.
  • i210277_TALHA_LAB_06.ipynb

    • Implements a K-Nearest Neighbors (KNN) classifier from scratch:
      • Stores training data explicitly
      • Implements Euclidean distance between samples
      • Finds the k nearest neighbors and uses majority voting for classification
    • Excellent for learning how a simple classification algorithm works internally.
  • i210277_TALHA_LAB_07.ipynb

    • Uses numpy, pandas, sklearn.datasets.load_wine, StandardScaler, PCA, and KNeighborsClassifier.
    • Focuses on:
      • Data standardization and feature scaling
      • Principal Component Analysis (PCA):
        • Computing mean and covariance
        • Eigenvalues and eigenvectors
        • Projecting 2D data to 1D
      • Applying KNN classification on transformed data
    • Bridges theory (PCA math) and practical use of scikit-learn.
  • i210277_TALHA_LAB_08.ipynb and i210277_TALHA_LAB_08(1).ipynb

    • Works with a classic PlayTennis-style dataset (Outlook, Temperature, Humidity, Wind, PlayTennis).
    • Typically used for rule-based classification / decision tree concepts:
      • Representing categorical data
      • Understanding how attributes relate to the target variable
    • You may see manual calculations of measures like entropy or information gain, or step-by-step reasoning about splits (depending on the version).
  • i210277_TALHA_LAB10.ipynb

    • Uses math and matplotlib.
    • Focuses on mathematical functions and visualization, likely in the context of ML algorithms:
      • Implementing formulas relevant to learning algorithms
      • Plotting curves and results with matplotlib
    • Good for building comfort with numerical computing and plotting results.
  • i210277_TALHA_LAB12.ipynb

    • Implements K-Means clustering from scratch:
      • Initializing centroids
      • Assigning data points to the nearest centroid (using Euclidean distance)
      • Updating centroids iteratively until convergence
    • Helps you understand unsupervised learning and how clusters are formed.
  • i210277_TALHA_LAB13.ipynb and i210277_TALHA_LAB_13.ipynb

    • Starts with data exploration on a custom dataset (e.g., body_length, body_breadth, lifespan_indicator, activity_level).
    • Focuses on:
      • Exploratory Data Analysis (EDA)
      • Inspecting and understanding new features
      • Potentially building simple models or doing clustering/classification on this data
    • Useful as a capstone-style lab to combine EDA and modeling skills.

1.2 Additional Notebooks (Exams / Advanced)

These notebooks are not part of the core tutorial flow but are useful as reference or practice:

  • i210277_AI_B_MidExam.ipynb – likely a midterm-style exam notebook covering concepts from early labs.
  • i210277_AIA_FinalExam.ipynb – likely a final exam notebook covering later/combined topics.
  • wsd_capsNet.ipynb and wsd_capsNet(1).ipynb – more advanced notebooks (e.g., word sense disambiguation or Capsule Networks) beyond the absolute beginner level.

You can explore these after you feel comfortable with the main labs.

1.3 Datasets

The *.csv files provide small, beginner-friendly datasets:

  • student_performance.csv

    • Used in i210277_TALHA_LAB_05.ipynb.
    • Contains information about students and their performance (e.g., study time, scores, etc.).
    • Ideal for practice with data loading, exploration, and simple analysis.
  • categorical_dataset.csv

    • A generic categorical dataset for practicing probability, contingency tables, and possibly decision trees.
    • Useful when learning to handle non-numeric variables.
  • Iris.csv

    • The classic Iris flower dataset: measurements of sepal/petal length/width and species labels.
    • Widely used for beginner classification (e.g., KNN, decision trees, SVM).
  • penguins.csv

    • A dataset similar to the Palmer Penguins dataset, with penguin measurements and species.
    • Great for visualization, EDA, and multi-class classification practice.

2. Prerequisites

To get the most out of these labs, you should have:

  • Basic Python knowledge
    • Variables, lists, dictionaries, functions, loops, and conditionals.
  • Some math background
    • High-school level algebra
    • Basic understanding of vectors and simple probability

2.1 Software Requirements

  • Python: Version 3.8 or later is recommended.
  • Jupyter Notebook or JupyterLab (or VS Code with Jupyter extensions).
  • Python libraries commonly used in these labs:
    • numpy
    • pandas
    • matplotlib
    • scikit-learn

You can install these using pip in a virtual environment.


3. Setup Instructions (Windows)

  1. Download or copy this folder

    • If you received it as a .zip, extract it (e.g., d:\Fall2025\ML-R1).
    • If using git, you could later turn this into a repo, but it is not required.
  2. Create and activate a virtual environment (recommended):

    # from inside d:\Fall2025\ML-R1
    python -m venv .venv
    .venv\Scripts\activate
  3. Install the required Python packages:

    pip install numpy pandas matplotlib scikit-learn
  4. Launch Jupyter Notebook or JupyterLab:

    jupyter notebook

    or

    jupyter lab
  5. Open a lab notebook

    • In the Jupyter interface, navigate to this folder.
    • Click on any .ipynb file (for example, i210277_TALHA_LAB_02.ipynb) to start.

4. Suggested Learning Path

If you are a complete beginner, the following order is recommended:

  1. Start with basic concepts and math:

    • i210277_TALHA_LAB_02.ipynb – Understanding TP/TN/FP/FN and classification metrics.
    • i210277_TALHA_LAB_03.ipynb / i210277_TALHA_LAB_03_Bpart.ipynb – Categorical data and contingency tables.
    • i210277_TALHA_04.ipynb – Vector operations and projections (linear algebra foundations).
  2. Move to data exploration:

    • i210277_TALHA_LAB_05.ipynb – Loading CSVs, basic EDA with pandas.
    • Practice with student_performance.csv, categorical_dataset.csv, and optionally Iris.csv / penguins.csv.
  3. Study classic ML algorithms:

    • i210277_TALHA_LAB_06.ipynb – KNN classifier implemented from scratch.
    • i210277_TALHA_LAB_07.ipynb – PCA and KNN with scikit-learn on the wine dataset.
    • i210277_TALHA_LAB_08.ipynb – Rule-based reasoning / decision tree concepts with PlayTennis-style data.
  4. Dive deeper into unsupervised learning and visualization:

    • i210277_TALHA_LAB10.ipynb – Numerical computations and plots related to ML concepts.
    • i210277_TALHA_LAB12.ipynb – K-Means clustering from scratch.
    • i210277_TALHA_LAB13.ipynb – EDA and modeling on a custom dataset.
  5. Optional / Advanced:

    • i210277_AI_B_MidExam.ipynb and i210277_AIA_FinalExam.ipynb – Use as practice exams.
    • wsd_capsNet.ipynb – Explore only after you are very comfortable; this is not beginner-level.

5. How to Use Each Lab Effectively

  • Read the markdown cells first

    • Many notebooks start with explanations or “Task” descriptions.
    • Understand the goal before running or editing code.
  • Run cells one by one

    • Use Shift + Enter to run each cell.
    • Watch outputs carefully (printed results, tables, plots).
  • Experiment with changes

    • Change input data (e.g., feature values, labels) and re-run to see effects.
    • Modify parameters like k in KNN or the number of clusters in K-Means.
  • Write small notes (comments) for yourself

    • Add short comments explaining in your own words what each block of code does.
    • This deepens your understanding and helps when revisiting later.

6. Common Issues and Tips

  • Module not found (e.g., ModuleNotFoundError: No module named 'pandas')

    • Make sure you activated your virtual environment and installed packages:
      .venv\Scripts\activate
      pip install numpy pandas matplotlib scikit-learn
  • Notebook uses a different kernel

    • In Jupyter, ensure the kernel is the Python environment where you installed the packages (KernelChange kernel).
  • Plots not appearing

    • Make sure you have run all previous cells, especially any imports like import matplotlib.pyplot as plt.
  • Data file not found (e.g., FileNotFoundError: student_performance.csv)

    • Check that:
      • You are running the notebook from the correct folder (d:\Fall2025\ML-R1).
      • The CSV file name and path in the code match the actual file name.

7. Next Steps After Completing These Labs

Once you are comfortable with all the labs in this repository, you can:

  • Try more complex datasets (Kaggle, UCI ML Repository, etc.).
  • Implement other algorithms from scratch (e.g., logistic regression, decision trees, Naive Bayes).
  • Practice building end-to-end projects:
    • Problem definition
    • Data collection and cleaning
    • EDA, feature engineering
    • Model training, evaluation, and deployment (even if only locally).

This repository is a solid foundation for your journey into machine learning. Take your time with each notebook, experiment freely, and don’t hesitate to revisit earlier labs as your understanding grows.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages