-
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