🌍 Week 6 Homework β€” Feedback

Student: Sofia Bruga
Assignment: Solow Model Calibration: Grid Search vs Optimization Tools


βœ… Overall Assessment

Result: βœ… More than 50% Correct

Good submission with all three optimization methods correctly implemented. The model fit plot shows all three methods for comparison. Comparison comments are provided. However, two issues are present: (1) Objective plot only shows grid search instead of all three optima markers (fminsearch and fmincon should also be marked on the objective plot), and (2) timing measurements are missing for all three methods. The code structure is good.


πŸ” 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 ❌ Missing: No timing measurements (tic/toc) for any method
6.2 Display optimization results βœ… Displays results for all three methods
6.3 Comment comparing methods βœ… Provides comparison comments (lines 90-93) discussing speed, robustness, and similarity
7.1 Plot objective with all three optima ❌ Missing: Plot (lines 37-42) only shows grid search curve, missing fminsearch and fmincon optima markers
7.2 Plot model fit (data vs model) βœ… Excellent - Plot shows data vs fitted model for all three methods
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
  • fmincon with Bounds: Correctly implemented with proper options
  • Helper Function: solow_simulate() correctly implements Solow dynamics
  • Timing: ❌ Missing - No timing measurements for any method
  • Figure Management: Creates Figures directory and saves figures properly using saveas()
  • Code Organization: Good - well-structured with clear sections

πŸ’¬ Style & Clarity

  • Code Quality: Good 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
  • Organization: Well-structured code with clear separation of methods

πŸ“Š Visual Output Assessment

Figure 1: Objective Function ⚠️

  • Layout: Plot showing SSE vs s for grid search only
  • Features: Shows objective function curve but only for grid search
  • Styling: Good styling with proper labels and title
  • Saving: βœ… Saves to Figures/ directory
  • Issue: Missing fminsearch and fmincon optima markers - should show all three methods’ results on the same plot

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
  • Styling: Appropriate styling with proper labels, legend, grid
  • Saving: βœ… Saves to Figures/ directory
  • Quality: Excellent visualization comparing all three methods

βœ… Suggestions for Improvement

  1. CRITICAL: Update objective plot (Figure 1) to show all three optima:
    figure;
    plot(s_grid, SSE, 'LineWidth', 1.5); hold on; grid on;
    plot(s_hat_grid, obj(s_hat_grid), 'o', 'MarkerSize', 8, 'DisplayName', 'Grid');
    plot(s_hat_fminsearch, fval, 's', 'MarkerSize', 8, 'DisplayName', 'fminsearch');
    plot(s_hat_fmincon, fval_con, 'd', 'MarkerSize', 8, 'DisplayName', 'fmincon');
    xlabel('s'); ylabel('SSE(s)');
    title('Objective function: SSE vs s');
    legend('Location','best');
    saveas(gcf, 'Figures/SSE_gridsearch.png');
    
  2. CRITICAL: Add timing measurements for all three methods:
    tic;
    % ... grid search code ...
    time_grid = toc;
       
    tic;
    % ... fminsearch code ...
    time_fminsearch = toc;
       
    tic;
    % ... fmincon code ...
    time_fmincon = toc;
    

🎯 Summary

Good submission with missing requirements. The student demonstrates understanding of optimization methods, implementing all three methods correctly (grid search, fminsearch with sigmoid, and fmincon). The code includes good organization with clear sections, comparison comments discussing speed, robustness, and similarity, and excellent model fit plot showing all three methods. However, two issues are present: (1) objective plot only shows grid search instead of all three optima markers, and (2) no timing measurements for any method.

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