Visualize probability distributions from SciPy using Plotly-Dash. I made this to review and better understand various probability distributions, and to serve as a handy tool to use alongside scikit-learn's RandomizedSearchCV when tuning machine learning models.
Freely hosted here, availability not guaranteed.
- app.py
- load distributions from SciPy, setup dash application, handle callbacks
- distributions.py
- functions to
- update info text and parameter inputs on page with distribution choice
- generate histogram and violin plots from given distribution and parameters
- five thousand points generated:
<distribution>.rvs(<shape_parameters>,<loc>,<scale>,5000)
- five thousand points generated:
- functions to
- Python
- class inspection to extract distributions and their information from SciPy
- SciPy
- experience with probability distributions, code, documentation
- Dash, Plotly
- graphs with custom hover data, colors, titles
- only use Go figures, so plotly-express and pandas are not required packages
- advanced callback usage. | works, imperfectly
- distribution selection from dropdown determines parameters (and info text) which determine graphs
- graphs updated by sliders or text inputs
- sliders and text boxes update if their corresponding partner is changed
- circular callback warning, causes graphs to update twice each time
- simple single page application, easy deployment
- minimal CSS styling, no CSS/JSS toolkits like Bootstrap
- could use something to display LaTeX, SciPy docs utilize sphinx which uses MathJax?
- graphs with custom hover data, colors, titles
- Requirements File lists all packages frozen in my development environment
- install dash and SciPy in a Python environment to run the applcation
The code can be run from a virtual environment on your local machine.
Download the code to a new directory, your-directory
Only the python files .py and assets (your-directory/assets) directory are necessary to run the application.
# Adapt for your operating system
cd your-directory
python -m venv venv
venv\scripts\activate
python -m pip install --upgrade pip
# install packages via requirements.txt
pip install -r requirements.txt
# OR install packages separately
pip install dash scipy
# ensure server settings are ok before running
python -m appThe application will be available on the default port, 8050, at http://127.0.0.1:8050/.
Change DEBUG settings or adapt deployment for WSGI by modying the run command.