Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Monte Carlo Simulations in Python

Cursus bekijken

Oefeninstructies

  • 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.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Complete the hexbin to visualize sensitivity analysis results
____(x=____,
     y=____,
     C=____,
     reduce_C_function=____,
     gridsize=10,
     cmap="viridis",
     sharex=False)
plt.show()
Code bewerken en uitvoeren