<jupyter_start><jupyter_text>Predicting the refractive index for the Materials ProjectThis notebook will predict the refractive index for ~68,000 materials from the Materials Project (MP).This is done by using the pretrained model "refractive_index" available in the following directory: modnet/pretrained. Load modelFirst the MODNetModel is loaded:<jupyter_code>import sys
#sys.path.append('..')
from modnet.models import MODNetModel
from modnet.preprocessing import MODData
model = MODNetModel.load('../pretrained/refractive_index')<jupyter_output><empty_output><jupyter_text>Load MODDataIn order to predict it on new structures a MODData should be created. Here we want to predict on structures from the MP, and therefore load the precomputed MP MODData.This takes some time and memory.<jupyter_code>MP_data = MODData.load("../moddata/MP_2018.6")<jupyter_output><empty_output><jupyter_text>Predict on new structuresBy using the predict() method on the MP_data, a dataframe containing the predictions is obtained.<jupyter_code>df = model.predict(MP_data)
df<jupyter_output><empty_output><jupyter_text>As a test, 3 materials with id mp-19033, mp-559175, and mp-6930, not included in the training set, were computed by DFT with corresponding 'true' refractive index: 2.59, 2.53 and 1.56.The following  approximation was found by our model, in a fraction of time:<jupyter_code>df.loc[['mp-19033', 'mp-559175', 'mp-6930']]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08482758620689655, 'fraction_numerical': 0.034482758620689655, 'mean_word_length': 6.557291666666667, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '501144', 'license': 'MIT', 'n_tokens_mistral': 471, 'n_tokens_neox': 430, 'n_words': 152, 'path': 'example_notebooks/predicting_ref_index.ipynb', 'repo_name': 'ml-evs/modnet', 'size': '1450'}