machlearn module¶
-
class
pyIsoP.machlearn.machlearn(scale=0.5, bounds=0.1, 10.0, restarts=10)¶ Bases:
objectContains code to train the machine learning model to predict the first shell coordination nunber using Gaussian Process Regression (GPR) * Features : logarithm_10 of pressure [log(P)], void fraction (VF), largest cavity dia (LCD), pore limiting dia. (PLD) * refer to the documentation page for the format of the training data
-
GPR4n1(data_file, train_fraction)¶ Quick and easy default function to train and test the Gaussian Process Regression (GPR) model for predicting the first shell coordination number as a function of logarithm_10 of pressure [log(P)], void fraction (VF), largest cavity dia (LCD) and pore limiting dia. (PLD). DEFAULTS: The kernel used is RationalQuadratic with length scale=0.5 with lengths bounded by (0.1,10) and 10 optimizer restarts.
The choice of the kernel is based on preliminary testing. To use a differerent kernel refer to https://scikit-learn.org/stable/modules/gaussian_process.html#gaussian-process-regression-gpr
to use a different method refer to: https://scikit-learn.org/stable/supervised_learning.html#supervised-learning
both of which beyond the scope of this simple routine.
- Parameters
data_file (str) – The path to the text file with the training and testing data.
File should have 5 columns corresponding to (no header line): logarithm_10 of pressure [log(P)], void fraction (VF), largest cavity dia (LCD), pore limiting dia. (PLD), first shell coordination number (n1)
- Parameters
ml_obj (instacne of the machlearn class) – will be updated with the testing, training data and predictions and the Gaussian Process Regressor handle from scikit-learn.
train_fraction (float) – fraction of the data to be used as the training part. Rows will be chosen randomly
- Raises
- Return type
An update instance of the machlearn class
-