Data from: Predicting and improving complex beer flavor through machine learning
Creators
Description
This repository contains all the supplemental files and scripts for the Nature Communications paper 'Predicting and Improving Complex Beer Flavor through Machine Learning'.
Init_modeling.py
Helper script that contains some functions for model performance evaluation and storage.
Jupyter Notebook for training machine learning models.ipynb
Jupyter notebook containing the code to train the 10 different machine learning models of the research article, including hyperparameter optimization and model performance evaluation.
The 10 models included are:
- Linear regression
- Lasso regression
- Partial least squares regression
- Random Forest regression
- Extra-trees regression
- Adaboosted regression
- Gradient boosting regression
- XGBoosting regression
- Support vector regression
- Multi-layered perception
Machine learning models transcript.py
A direct copy of the Jupyter Notebook, as a regular Python script.
Main figure generator.Rmd
R Markdown file that generates the figures from the paper's main text.
Sensory data quality control - ANOVA on repeated samples.Rmd
R Markdown file that performs ANOVA on the beer samples that were repeated in multiple sessions with the trained panel.
Supplemental Figure generator.Rmd
R Markdown file that generates the supplemental figures of the paper.
Supplemental Files and Figure source files.xlsx
Excel file containing all the supplemental files and tables, and the raw data underlying every figure (main and supplemental) in the manuscript.
RateBeer_Appreciation_Gradient_Boost_Regressor.pkl
Pickled version of the best-performing model for predicting RateBeer Appreciation from chemical composition (Python version 3.9.16).
RateBeer_Full_Model_Gradient_Boost_Regressor.pkl
Pickled version of the best-performing model for predicting all RateBeer scores, from beer chemical composition (Python version 3.9.16).
SHAP analysis.ipynb
Jupyter Notebook that performs SHAP analysis on the models. It also extracts the SHAP values in a CSV file to make a customized SHAP plot in R with the "Main Figure Generator.Rmd" script.
Partial Dependence Plots with SHAP.ipynb
Jupyter Notebook that generates Partial Dependence Plots of your model for compounds of your choice.
SYSTEM REQUIREMENTS
Any operating system capable of running Python v3.9.16 and R v4.2.2
Python v3.9.16 packages:
anaconda 2023.07
conda 23.5.0
joblib 1.2.0
numpy 1.24.3
pandas 1.5.3
scikit-learn 1.2.2
seaborn 0.12.2
shap 0.41.0
xgboost 1.7.3
R v4.2.2 packages:
factoextra 1.0.7
forcats 1.0.0
ggbeeswarm 0.7.1
ggpmisc 0.5.2
ggpubr 0.6.0
ggsignif 0.6.4
ggtext 0.1.2
grid 4.2.2
gridExtra 2.3
Hmisc 4.8.0
naniar 1.0.0
psycho 0.6.1
RColorBrewer 1.1.3
shapes 1.2.7
stats 4.2.2
svglite 2.1.1
tidyquant 1.0.6
tidyverse 2.0.0
INSTALLATION GUIDE
Download and install Python from Python or Anaconda.
Download and install R from CRAN.
Packages are installed with the built-in package installers.
DEMO / INSTRUCTIONS FOR USE
All available data is included in the file "Supplemental Files and Figure source files.xlsx".
Open the worksheet of your choise and save this as a .CSV file.
All scripts refer to the corresponding worksheet names whenever the data is required.
The expected output is identical to the figures, tables and supplemental files presented in the manuscript.
Files
Jupyter Notebook for training machine learning models.ipynb
Files
(52.4 MB)
Name | Size | Download all |
---|---|---|
md5:c02fab431d33b40a06c0235cbbc61998
|
10.4 kB | Download |
md5:6b311c6c3575f8dc27070fbed7bf916a
|
250.4 kB | Preview Download |
md5:06bffe872df9b6f109c6d8dca78ecfd7
|
34.7 kB | Download |
md5:ebaee5c79bd6f469a8141b3a7a65f77f
|
72.8 kB | Download |
md5:d7015e3002a2408a06bf2146c8cecf83
|
246.8 kB | Preview Download |
md5:337efb929cfa6ddf407a3f8fa2e5a3de
|
6.5 MB | Download |
md5:b4b675fa380e1b6c5f518d015199db42
|
39.5 MB | Download |
md5:e17db170c85fa4a5c323efb6b17bfd74
|
3.5 kB | Preview Download |
md5:159e670db065576fe8416f52786aaec2
|
2.7 kB | Download |
md5:7ae8b28243945344d6f0059a1fedc491
|
473.8 kB | Preview Download |
md5:5ca72605a1d90a53670c224ebaa04f88
|
42.2 kB | Download |
md5:52645e38d90aafda272532e19e2fea1c
|
5.3 MB | Download |