🌍 Week 6 Homework — Feedback
🌍 Week 6 Homework — Feedback
Student: Alessandra Nishaj
Assignment: Solow Model Calibration: Grid Search vs Optimization Tools
✅ Overall Assessment
Result: ✅ More than 50% Correct
Excellent submission with all three optimization methods correctly implemented, comprehensive timing measurements for fminsearch and fmincon, and outstanding comparison comments that directly answer the homework questions. The objective plot correctly shows all three optima with distinct markers, and the model fit plot shows all three methods for comparison. However, timing is missing for grid search. The code structure is excellent with clear documentation and proper figure management.
🔍 Task-by-Task Check
| Task | Description | Status | Notes |
|---|---|---|---|
| 1.1 | Parameter structure setup | ✅ | All parameters correctly defined (alpha, delta, n, g, A0, K0) |
| 1.2 | Data generation or loading | ✅ | Synthetic data correctly generated |
| 2.1 | Objective function definition | ✅ | Correct: sum((solow_simulate(s, params, T) - y_data).^2) |
| 3.1 | Create grid s ∈ [0.05, 0.5] | ✅ | Grid created with 200 points using linspace |
| 3.2 | Compute SSE for each grid point | ✅ | Loop correctly computes SSE for all grid points |
| 3.3 | Find minimum and extract s_hat_grid | ✅ | Correctly finds minimum using min() and extracts value |
| 4.1 | Implement sigmoid function | ✅ | Correct: sigmoid = @(x) 1./(1 + exp(-x)) |
| 4.2 | Create objective wrapper | ✅ | Correct: obj_transformed = @(x) obj(sigmoid(x)) |
| 4.3 | Call fminsearch and convert result | ✅ | Correctly calls fminsearch and converts x back to s using sigmoid |
| 5.1 | Set bounds [0, 1] correctly | ✅ | Bounds correctly set (lb=0.001, ub=0.999 for numerical stability) |
| 5.2 | Call fmincon with proper syntax | ⚠️ | Partial: fmincon called correctly but missing explicit optimoptions (uses defaults) |
| 6.1 | Display computation times | ⚠️ | Partial: Times fminsearch and fmincon, but missing timing for grid search |
| 6.2 | Display optimization results | ✅ | Displays results for all three methods with timing information |
| 6.3 | Comment comparing methods | ✅ | Excellent - Provides comprehensive comparison comments (lines 95-112) directly answering homework questions on speed, robustness, and similarity |
| 7.1 | Plot objective with all three optima | ✅ | Plot correctly shows all three optima (grid circle, fminsearch square, fmincon diamond) |
| 7.2 | Plot model fit (data vs model) | ✅ | Excellent - Plot shows data vs fitted model for all three methods with distinct line styles |
| 7.3 | Save figures in Figures/ folder | ✅ | Figures correctly saved using saveas() |
📈 Technical Implementation
- Grid Search: Correctly implemented with proper loop and minimum finding
- fminsearch with Sigmoid: Properly reparameterized using sigmoid function with timing
- fmincon with Bounds: Correctly implemented with bounds [0.001, 0.999] for numerical stability, includes timing, but missing explicit optimoptions
- Helper Function: Helper function likely exists in separate file (
solow_simulate.m) - Timing: ⚠️ Times fminsearch and fmincon, but missing timing for grid search
- Figure Management: Creates Figures directory and saves figures properly using saveas()
- Code Organization: Excellent - well-structured with clear sections
💬 Style & Clarity
- Code Quality: Excellent organization with clear section headers
- Variable Naming: Clear and descriptive (
s_hat_grid,s_hat_fmin,s_hat_fcon) - Comments: Good documentation with section labels and excellent homework comments section
- Output: Uses fprintf appropriately with formatted output including timing
- Organization: Well-structured code with clear separation of methods
📊 Visual Output Assessment
Figure 1: Objective Function with All Three Optima ✅
- Layout: Plot showing SSE vs s with all three optima marked
- Features: Shows grid search (red circle), fminsearch (green square), fmincon (magenta diamond) with distinct markers and colors
- Styling: Excellent styling with proper labels, legend, grid, and professional formatting
- Saving: ✅ Saves to Figures/ directory
- Quality: Excellent - clearly distinguishes all three methods with professional appearance
Figure 2: Model Fit Comparison ✅
- Layout: Plot showing observed data vs fitted model for all three methods
- Features: Excellent - Shows data and all three fitted paths (grid, fminsearch, fmincon) with distinct line styles and markers
- Styling: Excellent styling with proper labels, legend, grid, and professional formatting
- Saving: ✅ Saves to Figures/ directory
- Quality: Excellent visualization comparing all three methods
✅ Suggestions for Improvement
- CRITICAL: Add timing measurement for grid search:
tic; for i = 1:length(s_grid) SSE_grid(i) = obj(s_grid(i)); end time_grid = toc; fprintf('Grid Search: s* = %.4f, SSE = %.4f, Time = %.4fs\n', ... s_hat_grid, SSE_min_grid, time_grid); - Important: Add optimoptions for fmincon:
opts = optimoptions('fmincon','Display','off'); [s_hat_fcon, SSE_min_fcon] = fmincon(obj, 0.3, [], [], [], [], ... 0.001, 0.999, [], opts);
🎯 Summary
Excellent submission with comprehensive implementation and outstanding comments. The student demonstrates strong understanding of optimization methods, implementing all three methods correctly (grid search, fminsearch with sigmoid, and fmincon). The code includes excellent organization with clear sections, timing measurements for fminsearch and fmincon, and excellent comparison comments that directly answer the homework questions on speed, robustness, and similarity in detail. The objective plot correctly shows all three optima, and the model fit plot shows all three methods for comparison. However, two minor issues are present: (1) missing timing for grid search, and (2) fmincon missing explicit optimoptions. The comments section is particularly strong, providing clear answers to all three homework questions.
Grade Level: ✅ More than 50% Correct (11/12 tasks fully correct, 2/12 partially correct, 0/12 incorrect)