GlassPy: predicting
Introduction
GlassPy contains two prediction models: GlassNet
and ViscNet
. GlassNet is a multitask deep neural network capable of predicting 85 different glass properties and the temperature dependence of viscosity. ViscNet is a physics-informed deep neural network capable of predicting the temperature dependence of viscosity. Both models were trained with data from the SciGlass database.
GlassNet basic usage
Below is a minimal example of how to load and use the GlassNet model.
[1]:
from glasspy.predict import GlassNet
model = GlassNet()
composition = "Li2O(SiO2)2"
predictions = model.predict(composition)
predictions
[1]:
T0 | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | ... | Cp1673K | TMaxGrowthVelocity | MaxGrowthVelocity | CrystallizationPeak | CrystallizationOnset | SurfaceTensionAboveTg | SurfaceTension1173K | SurfaceTension1473K | SurfaceTension1573K | SurfaceTension1673K | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1656.182898 | 1275.016879 | 1178.333341 | 1064.154863 | 956.535513 | 893.408138 | 857.634124 | 820.458542 | 779.195534 | 755.95825 | ... | 1697.079401 | 1021.145482 | -6.457834 | 898.463696 | 818.476775 | 0.315797 | 0.299307 | 0.304303 | 0.314809 | 0.312099 |
1 rows × 85 columns
A composition can also be defined using a dictionary.
[2]:
composition = {
"SiO2": 2,
"Li2O": 1,
}
predictions = model.predict(composition)
predictions
[2]:
T0 | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | ... | Cp1673K | TMaxGrowthVelocity | MaxGrowthVelocity | CrystallizationPeak | CrystallizationOnset | SurfaceTensionAboveTg | SurfaceTension1173K | SurfaceTension1473K | SurfaceTension1573K | SurfaceTension1673K | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1656.182898 | 1275.016879 | 1178.333341 | 1064.154863 | 956.535513 | 893.408138 | 857.634124 | 820.458542 | 779.195534 | 755.95825 | ... | 1697.079401 | 1021.145482 | -6.457834 | 898.463696 | 818.476775 | 0.315797 | 0.299307 | 0.304303 | 0.314809 | 0.312099 |
1 rows × 85 columns
GlassNet also accepts pandas
DataFrames as input. Note that each row represents a material and that only columns related to compositions can exist in the DataFrame.
[3]:
import pandas as pd
data = [
[1, 0, 2],
[0, 1, 2],
[1, 1, 2],
]
df = pd.DataFrame(data, columns=["Li2O", "Na2O", "SiO2"])
df
[3]:
Li2O | Na2O | SiO2 | |
---|---|---|---|
0 | 1 | 0 | 2 |
1 | 0 | 1 | 2 |
2 | 1 | 1 | 2 |
[4]:
predictions = model.predict(df)
predictions
[4]:
T0 | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | ... | Cp1673K | TMaxGrowthVelocity | MaxGrowthVelocity | CrystallizationPeak | CrystallizationOnset | SurfaceTensionAboveTg | SurfaceTension1173K | SurfaceTension1473K | SurfaceTension1573K | SurfaceTension1673K | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1656.182898 | 1275.016816 | 1178.333278 | 1064.154806 | 956.535427 | 893.408194 | 857.634073 | 820.458542 | 779.195490 | 755.958250 | ... | 1697.079401 | 1021.145445 | -6.457834 | 898.463737 | 818.476730 | 0.315797 | 0.299307 | 0.304303 | 0.314809 | 0.312099 |
1 | 1896.291536 | 1513.411183 | 1279.021743 | 1123.006920 | 1035.724060 | 954.737548 | 912.160878 | 849.827548 | 809.466760 | 781.277537 | ... | 1484.994346 | 1064.050420 | -6.311865 | 967.297186 | 852.792449 | 0.281895 | 0.307567 | 0.284295 | 0.286678 | 0.274625 |
2 | 1490.654549 | 1233.614128 | 1101.165164 | 979.065643 | 921.910502 | 852.842278 | 785.283328 | 760.537597 | 724.843873 | 694.542212 | ... | 1746.768638 | 1077.191654 | -5.137042 | 856.429238 | 831.987634 | 0.323965 | 0.303260 | 0.322071 | 0.318062 | 0.325812 |
3 rows × 85 columns
GlassNet can also predict viscosity and the MYEGA viscosity equation parameters.
[5]:
predictions = model.predict_log10_viscosity(
T=1000,
composition=df,
)
predictions
[5]:
array([3.43780523, 4.38559973, 2.78879274])
[6]:
viscosity_parameters = model.viscosity_parameters(df)
viscosity_parameters
[6]:
log10_eta_infinity (Pa.s) | Tg_MYEGA (K) | fragility | |
---|---|---|---|
0 | -1.185329 | 697.868850 | 43.223825 |
1 | -1.700694 | 710.957761 | 35.991400 |
2 | -1.583741 | 637.292106 | 39.162854 |
Improving the GlassNet prediction
If you have the glasspy_extra
module installed, you can improve the GlassNet predictions by using a Random Forest model for certain properties. To do this, load the model with the loadrf
set to True
.
[7]:
model = GlassNet(loadrf=True)
predictions = model.predict(df)
predictions
[7]:
T0 | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | ... | Cp1673K | TMaxGrowthVelocity | MaxGrowthVelocity | CrystallizationPeak | CrystallizationOnset | SurfaceTensionAboveTg | SurfaceTension1173K | SurfaceTension1473K | SurfaceTension1573K | SurfaceTension1673K | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1656.182898 | 1275.016816 | 1178.333278 | 1064.154806 | 956.535427 | 893.408194 | 857.634073 | 820.458542 | 779.195490 | 755.958250 | ... | 1697.079401 | 1021.145445 | -6.457834 | 886.09 | 813.620 | 0.315797 | 0.299307 | 0.304303 | 0.314809 | 0.312099 |
1 | 1896.291536 | 1513.411183 | 1279.021743 | 1123.006920 | 1035.724060 | 954.737548 | 912.160878 | 849.827548 | 809.466760 | 781.277537 | ... | 1484.994346 | 1064.050420 | -6.311865 | 926.39 | 885.650 | 0.281895 | 0.307567 | 0.284295 | 0.286678 | 0.274625 |
2 | 1490.654549 | 1233.614128 | 1101.165164 | 979.065643 | 921.910502 | 852.842278 | 785.283328 | 760.537597 | 724.843873 | 694.542212 | ... | 1746.768638 | 1077.191654 | -5.137042 | 822.16 | 830.895 | 0.323965 | 0.303260 | 0.322071 | 0.318062 | 0.325812 |
3 rows × 85 columns
Note that this improvement comes at the expense of memory and performance.
ViscNet basic usage
The usage of ViscNet is similar to GlassNet. In fact, GlassNet performs better than ViscNet, so it is recommended to use GlassNet for viscosity prediction. Nevertheless, below is a minimal example of loading and using ViscNet.
[8]:
from glasspy.predict import ViscNet
model = ViscNet()
log10_viscosity = model.predict(T=1000, composition=df)
log10_viscosity
[8]:
array([5.0632305, 5.2332606, 6.148955 ], dtype=float32)
[9]:
fragility = model.predict_fragility(df)
print(fragility)
[32.876167 29.261871 34.904648]
[10]:
Tg = model.predict_Tg(df)
print(Tg)
[752.03784 735.4263 791.71893]