CommencerCommencer gratuitement

Sensitivity analysis using hexbin plot

The simulation results you generated in the previous exercise are saved in the DataFrame df_sa which has been loaded for you.

Recall that df_sa has three columns: Inflation contains the mean inflation rates used in the simulations, Volume contains the mean sales volumes used in the simulations, and Profit contains forecasted profits based on your simulation.

You'll now use a hexbin plot to perform sensitivity analysis and understand the impact of these parameters!

The following libraries have been imported for you: pandas as pd, numpy as np, scipy.stats as st, and matplotlib.pyplot as plt.

Cet exercice fait partie du cours

Monte Carlo Simulations in Python

Afficher le cours

Instructions

  • Complete the hexbin plot code to visualize the sensitivity analysis results; use Inflation as the x-axis, Volume as the y-axis, and the mean values of Profits as the basis for the color of the hexbins.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Complete the hexbin to visualize sensitivity analysis results
____(x=____,
     y=____,
     C=____,
     reduce_C_function=____,
     gridsize=10,
     cmap="viridis",
     sharex=False)
plt.show()
Modifier et exécuter le code