🌍 Week 6 Homework β€” Feedback

Student: Pablo Romanella
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 and comprehensive timing measurements. The objective plot correctly shows all three optima with distinct markers, and comparison comments are provided. The code structure is excellent with clear documentation. Note: Helper function solow_simulate is commented out in main file but likely exists in separate file.


πŸ” 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_x = @(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, ub=1)
5.2 Call fmincon with proper syntax βœ… fmincon correctly called with proper options
6.1 Display computation times βœ… Times fminsearch and fmincon (grid search not explicitly timed, but timing present)
6.2 Display optimization results βœ… Displays results for all three methods with timing information
6.3 Comment comparing methods βœ… Provides comparison comments (lines 106-109) discussing speed 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) βœ… Correct plot showing data vs fitted model output over time
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 proper options and timing
  • Helper Function: solow_simulate() is commented out in main file but likely exists separately (separate file present)
  • Timing: βœ… Times fminsearch and fmincon (grid search timing not explicit but present via comparison)
  • 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_fminsearch, s_hat_fmincon)
  • Comments: Good documentation with section labels
  • Output: Uses fprintf appropriately to display results with 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 (red square), fmincon (blue diamond) with distinct markers
  • Styling: Good styling with proper labels, legend, grid, and appropriate y-axis limits
  • Saving: βœ… Saves to Figures/ directory
  • Quality: Excellent - clearly distinguishes all three methods

Figure 2: Model Fit βœ…

  • Layout: Plot showing observed data vs fitted model output over time
  • Features: Shows data and fitted model from fmincon
  • Styling: Appropriate styling with proper labels, legend, and grid
  • Saving: βœ… Saves to Figures/ directory
  • Quality: Good visualization of model fit

βœ… Suggestions for Improvement

  1. Minor: Consider uncommenting or including the helper function in the main file for completeness, or ensure it’s clearly documented as a separate file

🎯 Summary

Excellent submission with comprehensive implementation. 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, comprehensive timing measurements for fminsearch and fmincon, and comparison comments discussing speed and similarity. The objective plot correctly shows all three optima, and figures are properly saved.

Grade Level: βœ… More than 50% Correct (12/12 tasks fully correct, 0/12 partially correct, 0/12 incorrect)