https://github.com/chaos-polymtl/machine-learning-tools
Machine learning tools in Python
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.6%) to scientific vocabulary
Repository
Machine learning tools in Python
Basic Info
- Host: GitHub
- Owner: chaos-polymtl
- Language: Python
- Default Branch: main
- Size: 3.17 MB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
machine-learning-tools
Machine learning tools in Python
Artificial Neural Network (ANN)
In the folder ann, the Python file ann.py contains the definition of the functions used to build an ANN model.
read_datareads the data in a.csvfile where the first columns are the features and the last column is the output. The function uses the Pandas library to read the file and converts the DataFrame into two Numpy tensors, X and Y. X is the tensor of the inputs and Y is the tensor of the output.initial_setupnormalizes X and Y using a MinMax scaling from the Scikit-learn library. It also splits the database into a training and testing set.fit_modelbuilds and trains the ANN's model with the TensorFlow library.
The Python file mixer_main.py builds and trains the ANN model with the dataset of CFD simulations of mixers. In the database folder, the file mixer_database.csv includes approximately 100k Lethe simulations of pitched blade impeller mixers. The database has 7 features (Reynolds number and geometric ratios) and 1 output (power number).
Grid search
Within the ann folder, a Python file grid_search.py is included to show an example of a grid search algorithm to tune the hyperparameters of the ANN model. The grid search method uses a cross-validation technique. This example uses the database of mixers.
Physics-informed Neural Network (PINN)
In the folder pinn, the Python file pinn.py contains the definition of the functions used to build a PINN model. The PINN is built for a set of ODEs describing the molar balance of chemical species. The ODEs depends on rate constants $k$. The set of reactions at study is:
$A \leftrightarrow C + B$ and
$C \leftrightarrow D$
The PINN tries to identify 4 kinetic constants ($k1$, $k2$, $k3$ and $k4$) of the above reactions. The PINN model is coded using the PyTorch library.
- The class
PINeuralNetuses the base classtorch.nn.Module. It allows to build the architecture, set up the 4 parameters and define the forward pass. - The class
Curiosity(named after the rover Curiosity from NASA that went on planet Mars to discover some wonders) trains the PINN model. The loss function is define in this class. Note that Curiosity can be easily change to satisfy any kind of ODEs.
Other files goes with the PINN model:
- data.py reads the data in the kinetic_database.csv file where the first column is the indenpendant variable and the next columns are the dependant variables, or the concentrations in this case.
- ode.py computes the numerical solution of the set of ODEs. It uses a Runge-Kutta method.
- main_kinetic.py builds and trains the PINN model with the dataset of species concentrations.
Owner
- Name: CHAOS Laboratory
- Login: chaos-polymtl
- Kind: organization
- Location: Canada
- Repositories: 16
- Profile: https://github.com/chaos-polymtl
CHAOS Laboratory of the department of Chemical Engineering at Polytechnique Montréal
GitHub Events
Total
Last Year
Dependencies
- matplotlib ==3.1.2
- numpy ==1.24.2
- pandas ==1.5.3
- sklearn ==0.0
- tensorflow ==2.9.2
- torch ==1.12.1