Recommended Tools and Setup for Lab

 

Recommended Tools 

Core Stack 

ToolPurpose
Python        Main language
Jupyter Notebook        Interactive lab work
NumPy        Numerical computation
Pandas        Data handling
Matplotlib / Seaborn        Visualization
Scikit-learn        ML algorithms



Advanced Tools 

ToolUse
Google Colab    No-install lab 
Kaggle Notebooks    datasets + practice
TensorFlow / PyTorch        neural networks
Streamlit    mini project deployment


 Best Offline Setup (Recommended)

 Use Anaconda (Easiest)

This is the best choice for students.

🔹 Steps:

  1. Download Anaconda from https://www.anaconda.com/download
  2. Install it
  3. It includes:
    • Python
    • Jupyter Notebook
    • NumPy, Pandas, Matplotlib
  4. Open Jupyter Notebook
  5. Start coding ML programs

👉 No need to install packages separately


Two Main Ways to Manage Python Packages

✅ Method 1: Using pip (Standard)

  • Comes with Python
  • Simple and widely used

✅ Method 2: Using conda (Recommended for ML)

  • Comes with Anaconda
  • Better for handling dependencies

👉 Recommendation:
Use conda for teaching labs, pip for basic usage


 Installing Packages (Step-by-Step)

🔹 Using pip

pip install numpy pandas matplotlib seaborn scikit-learn

Install specific version:

pip install numpy==1.26.0

🔹 Using conda

conda install numpy pandas matplotlib seaborn scikit-learn

👉 Automatically handles compatibility (very useful for students)


Creating Separate Environments (VERY IMPORTANT)

👉 Avoids “it works on my system” problems

🔹 Using conda (Best method)

Create environment:

conda create -n ml_lab python=3.10

Activate:

conda activate ml_lab

Install packages:

conda install scikit-learn pandas matplotlib

🔹 Using pip (venv)

python -m venv ml_env

Activate:

  • Windows:
ml_env\Scripts\activate
  • Linux/Mac:
source ml_env/bin/activate

Then install:

pip install numpy pandas scikit-learn



💡 Why environments matter

Without environments:

  • Package conflicts ❌
  • Version issues ❌
  • Broken code ❌

With environments:

  • Clean setup ✅
  • Reproducibility ✅
  • Easy grading ✅

Keeping Track of Packages

🔹 Export environment (important for labs)

pip:

pip freeze > requirements.txt

conda:

conda env export > environment.yml

🔹 Install from file

pip:

pip install -r requirements.txt

conda:

conda env create -f environment.yml

👉 This is very useful for distributing lab setups to students


Updating Packages

pip:

pip install --upgrade numpy

conda:

conda update numpy

Removing Packages

pip:

pip uninstall numpy

conda:

conda remove numpy

Comments

Popular posts from this blog

Machine Learning Lab PCCSL508 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Explore Californoa Housing Dataset