Skip to content

Add 4 new PyTorch tasks for CMPE 258 Homework 1#3

Open
abharathkumarr wants to merge 6 commits into
lkk688:mainfrom
abharathkumarr:homework1-new-tasks
Open

Add 4 new PyTorch tasks for CMPE 258 Homework 1#3
abharathkumarr wants to merge 6 commits into
lkk688:mainfrom
abharathkumarr:homework1-new-tasks

Conversation

@abharathkumarr
Copy link
Copy Markdown

New tasks following pytorch_task_v1 protocol:

  1. ridge_lvl1_cv_hyperparam - Ridge Regression with K-Fold CV
  2. elasticnet_lvl1_wine_quality - Elastic Net on Wine Quality dataset
  3. logreg_lvl5_fashion_momentum - Logistic Regression with Momentum optimizers
  4. linreg_lvl5_lr_scheduling - Linear Regression with LR Scheduling

All tasks include:

  • Complete implementation of 9 required functions
  • Mathematical docstrings with formulas
  • Comprehensive error handling with fallback synthetic data
  • Visualization and artifact generation
  • Self-verification with exit codes and quality thresholds
  • Updated ml_tasks.json with task definitions

Tasks tested and verified with proper function compliance.

New tasks following pytorch_task_v1 protocol:
1. ridge_lvl1_cv_hyperparam - Ridge Regression with K-Fold CV
2. elasticnet_lvl1_wine_quality - Elastic Net on Wine Quality dataset
3. logreg_lvl5_fashion_momentum - Logistic Regression with Momentum optimizers
4. linreg_lvl5_lr_scheduling - Linear Regression with LR Scheduling

All tasks include complete implementation of 9 required functions,
mathematical docstrings with formulas, comprehensive error handling,
visualization and artifact generation, and self-verification with exit codes.

Made-with: Cursor
Made-with: Cursor
Task 1 - Ridge Regression (ridge_lvl1_cv_hyperparam):
Implemented ridge regression with manual k-fold cross validation to find best lambda parameter. Used California Housing dataset and tested 7 different regularization values. Final model achieved R2 of 0.58 with lambda=1.0.

Task 2 - Elastic Net (elasticnet_lvl1_wine_quality):
Built elastic net combining L1 and L2 regularization using gradient descent with soft thresholding. Applied to Wine Quality dataset and achieved 18% feature sparsity, reducing 11 features to 9 active ones. R2 score of 0.40 on test set.

Task 3 - Logistic Regression with Momentum (logreg_lvl5_fashion_momentum):
Compared 3 SGD variants (vanilla, momentum, Nesterov) on Fashion-MNIST classification. Implemented manual momentum updates and trained for 20 epochs each. Nesterov achieved best accuracy of 84.3% with F1 score of 83.9%.

Task 4 - LR Scheduling (linreg_lvl5_lr_scheduling):
Implemented linear warmup and cosine annealing learning rate schedule for linear regression on Diabetes dataset. Trained for 200 epochs with LR starting at 0.003, warming up for 10 epochs then decaying. Successfully demonstrated proper LR scheduling behavior.

All tasks follow pytorch_task_v1 protocol with required functions and self-verification.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant