This repository contains code originally created to develop surrogate ML models to mimic the utility of CFD simultations of Sulfur TES systems. It has been adapted to provide a comprehensive package for building, training, validating, testing, and optimizing regression models with customzable features and targets.
There is native support for the following model types:
- Neural Network (Tensorflow with Keras)
- XGBoost
- RandomForest
- Navigate to the
sulfur_tes_mldirectory - Execute the following command:
conda env create -p ./envSulfurTES -f envSulfurTES.yamlThis will create the conda environment within a new envSulfurTES directory.
** Note: You may get an error involving pip installation. You can ignore this error.
From the sulfur_tes_ml directory, run:
conda activate ./envSulfurTES
From the sulfur_tes_ml directory, run:
python setup.py install
The stesml package contains the utility functions used in the Jupyter notebooks.
From the sulfur_tes_ml directory, run:
jupyter lab
This will open Jupyter Lab in your default browser.
-
A detailed Jupyter Lab tutorial can be found here.
-
Open the
notebooksfolder -
The following notebooks are stable:
- STES_Predictions: Use this notebook to make predictions for a charging scenario.
- STES_Train_and_Validate: Use this notebook to train and validate a model.
- STES_Optuna_Studies: Use this notebook to optimize the hyperparameters of your model with Optuna.
- STES_Optuna_Visualization: Use this notebook to see visualizations of an Optuna study.
- STES_Final_Model: Once you are satisfied with a model design, use this notebook to train, test, and save a final model.
- STES_Hybrid_Model: Use this notebook to train and validate the hybrid model.
- STES_Hybrid_CV: Use this notebook to perform per-scenario evaluation of the hybrid model.
- Fluent_Out_to_CSV: This notebook takes data from a Fluent .out file, calculates secondary properties, and outputs data to a .csv file
-
The following notebooks are experimental:
- STES_Governing_Equations: This notebook uses PySINDY to learn governing equations from data.
- STES_LSTM: This notebook implements a Long Short-Term Memory recurrent neural network model.
- STES_PINN: This notebook implements a physics-informed neural network with a custom loss function.
If you want to use PySINDy to learn the governing equations from your dataset, perform the following steps:
- Ensure the
pythonyou are using is local to your conda environment by running:
which python
The response should end with sulfur_tes_ml/envSulfurTES/bin/python. If it doesn't there may be an issue with your $PATH variable. Read this article to get a better understanding of this issue and how to resolve it.
- Ensure the
pipyou are using is local to your conda environment by running:
which pip
The response should end with sulfur_tes_ml/envSulfurTES/bin/pip. If it doesn't, install pip to the conda environment with:
conda install pip
- From the
sulfur_tes_mldirectory, run:
python -m pip install pysindy
This process ensures you are installing the PySINDy package locally within the conda environment.
To deactivate the environment, run:
conda deactivate
Written by: Kevin Menear (kevin.menear@nrel.gov) and Dmitry Duplyakin (dmitry.duplyakin@nrel.gov) in collaboration with the National Renewable Energy Laboratories.
Full team: Kevin Menear, Dmitry Duplyakin, Michael J. Martin, Mohammad Rahimi, Janna Martinek, Zhiwen Ma
Refer to the file called: LICENSE.