-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
SRIJA DE CHOWDHURY edited this page Jan 4, 2026
·
1 revision
Before you begin, ensure you have the following installed:
|
Core programming language |
For installing dependencies |
VS Code, PyCharm, or Jupyter |
# Using HTTPS
git clone https://github.com/willow788/Logistic-Regression-Fron-Scratch.git
# Or using SSH
git clone git@github.com:willow788/Logistic-Regression-Fron-Scratch.git
# Navigate to the directory
cd Logistic-Regression-Fron-Scratch# Create virtual environment
python -m venv venv
# Activate on Windows
venv\Scripts\activate
# Activate on macOS/Linux
source venv/bin/activate# Install all required packages
pip install numpy pandas matplotlib seaborn jupyter scikit-learn
# Or install from requirements file (if available)
pip install -r requirements.txt| Package | Version | Purpose |
|---|---|---|
| NumPy | 1.21+ | Numerical computations |
| Pandas | 1.3+ | Data manipulation |
| Matplotlib | 3.4+ | Basic plotting |
| Seaborn | 0.11+ | Advanced visualizations |
| Jupyter | Latest | Interactive notebooks |
| scikit-learn | 0.24+ | Dataset & metrics (optional) |
# Launch Jupyter Notebook
jupyter notebook
# Or Jupyter Lab
jupyter labThen:
- Navigate to
Main jupyter notebook/folder - Open the main notebook
- Run cells sequentially (Shift + Enter)
# main.py
import numpy as np
from logistic_regression import LogisticRegression
# Load data
X_train, y_train = load_data()
# Initialize model
model = LogisticRegression(learning_rate=0.01, iterations=1000)
# Train model
model.fit(X_train, y_train)
# Make predictions
predictions = model.predict(X_test)📦 Logistic-Regression-Fron-Scratch/
│
├── 📂 Main jupyter notebook/
│ └── 📓 logistic_regression.ipynb ← Start here!
│
├── 📂 Improved Model/
│ └── 📓 improved_model.ipynb ← Advanced version
│
├── 📜 .gitignore
└── 📖 README.md
Run this quick test to ensure everything is working:
# test_installation.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
print("✅ NumPy version:", np.__version__)
print("✅ Pandas version:", pd.__version__)
print("✅ Matplotlib version:", plt. matplotlib.__version__)
print("✅ Seaborn version:", sns.__version__)
print("\n🎉 All packages installed successfully!")Expected output:
✅ NumPy version: 1.21.0
✅ Pandas version: 1.3.0
✅ Matplotlib version: 3.4.0
✅ Seaborn version: 0.11.0
🎉 All packages installed successfully!
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt# Using sklearn's breast cancer dataset as example
from sklearn.datasets import load_breast_cancer
data = load_breast_cancer()
X = data.data
y = data.targetfrom sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)# Your custom logistic regression model
model = LogisticRegression(learning_rate=0.01, n_iterations=1000)
model.fit(X_train, y_train)accuracy = model.score(X_test, y_test)
print(f"Accuracy: {accuracy:.2%}")
|
|
❌ ModuleNotFoundError: No module named 'numpy'
Solution:
pip install numpy❌ Jupyter notebook not opening
Solution:
# Reinstall Jupyter
pip uninstall jupyter
pip install jupyter
# Try alternative
pip install jupyterlab
jupyter lab❌ Import errors in notebook
Solution:
- Ensure virtual environment is activated
- Restart Jupyter kernel:
Kernel → Restart - Reinstall packages in the correct environment
💡 Pro Tip #1: Always use a virtual environment to avoid package conflicts!
💡 Pro Tip #2: Run cells in order - don't skip cells in Jupyter notebooks!
💡 Pro Tip #3: Check the FAQ if you get stuck!
- 📖 Check the Troubleshooting Guide
- ❓ Read the FAQ
- 🐛 Open an Issue