π Week 6 Homework β Feedback
π Week 6 Homework β Feedback
Student: Davide Magnini
Assignment: Solow Model Calibration: Grid Search vs Optimization Tools
β Overall Assessment
Result: β οΈ Partial <50% Correct
Submission attempts all three optimization methods but contains several errors. The objective function may have issues (need to verify exact implementation), grid search implementation is incomplete, fmincon is missing optimoptions, and the objective plot doesnβt show all three optima. Missing timing measurements, comparison comments, and PNG format saving. Code structure is basic but needs improvement.
π Task-by-Task Check
| Task | Description | Status | Notes |
|---|---|---|---|
| 1.1 | Parameter structure setup | β | All parameters correctly defined |
| 1.2 | Data generation or loading | β | Synthetic data with noise correctly generated |
| 2.1 | Objective function definition | β οΈ | Line 24: obj = @(s_grid)sum(solow_simulate(s_grid,params,T) - y_data)^2; - likely incorrect (should have parentheses and .^2) |
| 3.1 | Create grid s β [0.05, 0.5] | β | Grid created with 200 points |
| 3.2 | Compute SSE for each grid point | β οΈ | Computes SSE but objective function may be incorrect |
| 3.3 | Find minimum and extract s_hat_grid | β | Error: Uses fminsearch(obj, s_true) instead of extracting grid minimum |
| 4.1 | Implement sigmoid function | β | Correct: sigmoid = @(x) 1./(1 + exp(-x)) |
| 4.2 | Create objective wrapper | β οΈ | Wrapper created but uses potentially incorrect obj function |
| 4.3 | Call fminsearch and convert result | β οΈ | Implementation present but may use incorrect objective |
| 5.1 | Set bounds [0, 1] correctly | β | Bounds correctly set (lb=0, ub=1) |
| 5.2 | Call fmincon with proper syntax | β οΈ | Missing optimoptions: Line 76 uses fmincon without optimoptions('fmincon','Display','off') |
| 6.1 | Display computation times | β | Missing: No tic/toc measurements |
| 6.2 | Display optimization results | β οΈ | Partial: Basic fprintf statements but incomplete comparison |
| 6.3 | Comment comparing methods | β | Missing: No written comparison comments |
| 7.1 | Plot objective with all three optima | β | Missing: Plot only shows grid search curve, no optima markers |
| 7.2 | Plot model fit (data vs model) | β | Plot created showing data vs fitted model |
| 7.3 | Save figures in Figures/ folder | β | Figures correctly saved in PDF format |
π Technical Implementation
- Objective Function: β οΈ Likely Error - Line 24 missing parentheses and
.^2notation - Grid Search: β Uses
fminsearchinstead of extracting grid minimum - fminsearch with Sigmoid: Implementation present but depends on correct objective function
- fmincon: β οΈ Missing
optimoptionsfor cleaner output (line 76) - Helper Function:
solow_simulate()function provided separately - Figure Management: Saves to Figures/ directory
π¬ Style & Clarity
- Code Quality: Basic organization
- Variable Naming: Some inconsistencies (
l0instead ofs0for fmincon initial guess) - Comments: Minimal comments
- Output: Basic fprintf statements
- Organization: Basic structure
π Visual Output Assessment
Figure 1: Objective Function β οΈ
- Layout: Plot showing SSE vs s
- Features: Only shows grid search curve
- Issue: Missing optima markers for all three methods
- Saving: β Saves PDF to Figures/ directory
Figure 2: Model Fit β
- Layout: Plot showing data vs fitted model
- Features: Shows data and fitted model
- Saving: β Saves PDF to Figures/ directory
β Suggestions for Improvement
- CRITICAL: Fix objective function definition:
obj = @(s) sum((solow_simulate(s, params, T) - y_data).^2); - CRITICAL: Fix grid search to extract minimum from grid:
[~, idx_min] = min(SSE); s_hat_grid = s_grid(idx_min); - CRITICAL: Add optimoptions to fmincon:
opts = optimoptions('fmincon','Display','off'); [s_hat_fmincon, fval_fmincon] = fmincon(obj, s0, [], [], [], [], lb, ub, [], opts); -
CRITICAL: Add all three optima markers to objective plot
-
CRITICAL: Add timing measurements (tic/toc) for all three methods
- Important: Add comparison comments (2-3 lines) discussing speed, robustness, similarity
π― Summary
Submission with several errors requiring correction. The student attempts all three optimization methods and includes both required figures. However, there are multiple errors: (1) objective function likely incorrectly defined, (2) grid search uses fminsearch instead of extracting grid minimum, (3) fmincon missing optimoptions, and (4) objective plot doesnβt show all three optima. Missing timing measurements and comparison comments. Code structure is basic but needs improvement in technical correctness.
Grade Level: β οΈ Partial <50% Correct (5/12 tasks fully correct, 5/12 partially correct, 2/12 incorrect)