A collection of five interactive Django web applications exploring human-centric machine learning paradigms, developed as coursework at TU Hamburg.
| Project | Topic | Key Technique |
|---|---|---|
| 1 | AutoML Interface | Supervised Learning Pipeline |
| 2 | Active Learning | Pool-Based Sampling for Text |
| 3 | Explainability | Sparse Models & Counterfactuals |
| 4 | Recommender Systems | Matrix Factorization + Cold Start |
| 5 | RLHF | Reinforcement Learning with Human Feedback |
Interactive web interface for end-to-end supervised learning workflows.
- Data Upload & Visualization: CSV upload with scatter plot generation (X vs Y, Feature vs Target)
- Automatic Problem Detection: Infers classification vs regression from target column
- Model Selection: Logistic Regression, SVM, Random Forest, Linear Regression
- Hyperparameter Tuning: Grid search with user-configurable parameter ranges
- Evaluation: Confusion matrix (classification) or True vs Predicted plots (regression)
CSV → Preprocessing (StandardScaler, OneHotEncoder) → GridSearchCV → Model → Evaluation
Models: LogisticRegression, SVC, RandomForestClassifier, LinearRegression, RandomForestRegressor
Pool-based active learning for IMDB sentiment analysis (50k movie reviews).
- Text Representation: TF-IDF vectorization (5000 features)
- Baseline Classifier: Logistic Regression trained on full dataset (~89% accuracy)
- Active Learning Strategies:
- Least Confident
- Margin Sampling
- Entropy-based
- Random Baseline
- Mixtures (LC+Entropy, Entropy+Random)
- Termination Conditions: Plateau detection, target accuracy threshold
# Utility functions for sample selection
def calculate_utility_scores(probas, strategy):
if strategy == "least_confident":
return 1 - np.max(probas, axis=1)
elif strategy == "entropy":
return -np.sum(probas * np.log2(probas + 1e-12), axis=1)Interactive exploration of model interpretability using the Palmer Penguins dataset.
- Sparse Decision Trees: GOSDT algorithm for optimal sparse trees
- Sparse Logistic Regression: L1 penalty with adjustable regularization
- Complexity Control: Lambda slider to trade off accuracy vs interpretability
- Counterfactual Explanations: "What-if" analysis using MAD-weighted L1 distance
Interpretability Objective: argmin_f (1/n)Σℓ(f(xi), yi) + λΩ(f)
Counterfactual Generation:
- Sample N points locally around input x
- Filter to points with desired class prediction
- Rank by MAD-weighted L1 distance
- Display top-k counterfactuals
Interactive movie recommendation system addressing the cold-start problem using MovieLens dataset.
- Matrix Factorization: L2-regularized latent factor model
- Active Learning Strategies:
- Popularity-based (most-rated movies)
- Uncertainty-based (ratings closest to 3.0)
- Guidance System: Real-time impact preview showing how ratings affect recommendations
- User Study Interface: Complete A/B testing framework with logging
Matrix Factorization: min_{U,V} Σ(R_ij - U_i^T V_j)² + λ(||U||²_F + ||V||²_F)
New User Embedding: min_{u} Σ(R_ij - u^T V_j)² + λ||u||²_F (V fixed)
- Impact calculation showing prediction deltas before/after rating
- What-if preview panel for strategic user input
- PDF report generation for methodology documentation
Train a mouse agent to collect cheese using human preference feedback.
- 5×5 grid world with walls, traps, cheese (regular + organic)
- Rewards: +10 (cheese), -50 (trap), -0.2 (empty/wall bump)
- 4 actions: Up, Down, Left, Right
- REINFORCE Algorithm: Policy gradient with CNN policy network
- Bradley-Terry Preference Model: Learn rewards from human trajectory comparisons
- RLHF Training: Fine-tune policy using learned reward with KL penalty
# Policy Network (from project specification)
PolicyNetwork:
Conv2d(6→16, 3×3) → ReLU → Conv2d(16→32, 3×3) → ReLU
→ Flatten → Linear(800→64) → ReLU → Linear(64→4) → Softmax
# Reward Network
RewardNetwork:
Conv2d(6→16, 3×3) → ReLU → Flatten → Linear(400→64) → ReLU → Linear(64→1)1. Train base policy with REINFORCE
2. Generate trajectory pairs
3. Collect human preferences (which trajectory is better?)
4. Train Bradley-Terry reward model: P(τ₁ ≻ τ₂) = σ(R(τ₁) - R(τ₂))
5. Fine-tune policy with learned reward + KL penalty to original policy
Django Python scikit-learn PyTorch NumPy Pandas Matplotlib TF-IDF NLTK
# Clone repository
git clone https://github.com/rahulkvr/hcai.git
cd hcai
# Option A: Conda
conda env create -f environment.yml
conda activate hcai
# Option B: pip
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Run server
python manage.py runserverAccess at http://127.0.0.1:8000/
TU Hamburg — Human-Centric AI Course
