<jupyter_start><jupyter_text>Mean Squared Error ExampleThe following example uses the elastic_tensor_2015 dataset and a default config to create a MatPipe. This MatPipe is used to benchmark the target property K_VRH. We use the resulting information to determine the mean squared error.  Setting up the DataframeUse the load dataset function to get access to the dataset in Automatminer. In this example, we will be loading the elastic_tensor_2015 dataset.<jupyter_code>from matminer.datasets.dataset_retrieval import load_dataset

df = load_dataset("elastic_tensor_2015")<jupyter_output><empty_output><jupyter_text>Use get_preset_config to use different pre-built configurations for a MatPipe. The options include production, default, fast, and debug. Specific details about each config can be seen in presets.py. In this example, we will be using the debug config for a short program runtime. Then, we will pass in the parameter as an argument of MatPipe to get a MatPipe object.<jupyter_code>from automatminer.presets import get_preset_config
from automatminer.pipeline import MatPipe

debug_config = get_preset_config("debug")
pipe = MatPipe(**debug_config)<jupyter_output><empty_output><jupyter_text>The preset automatminer uses pre-defined column names 'composition' and 'structure' to find the composition and structure columns. You can change these by editing your config.<jupyter_code>df = df.rename(columns={"formula": "composition"})[["composition", "structure", "K_VRH"]]<jupyter_output><empty_output><jupyter_text>BenchmarkingIn this example, we are performing an ML benchmark using MatPipe in order to see how well AutoML can predict a certain target property. The target property we will be benchmarking in this example is K_VRH.<jupyter_code>predicted = pipe.benchmark(df, "K_VRH", test_spec=0.2)<jupyter_output><empty_output><jupyter_text>Calculating MSEThe predicted variable is a dataframe that contains several columns, including actual property values and predicted property values. In this example, we will use the actual K_VRH data and the predicted K_VRH data in order to see how well the benchmarking went.<jupyter_code>y_true = predicted["K_VRH"]
y_test = predicted["K_VRH predicted"]<jupyter_output><empty_output><jupyter_text>Use the mean_squared_error function from sklearn to calculate the mean squared error of predicted vs. actual K_VRH data.<jupyter_code>from sklearn.metrics.regression import mean_squared_error

mse = mean_squared_error(y_true, y_test)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.060786650774731825, 'fraction_numerical': 0.0055621771950735005, 'mean_word_length': 6.943217665615142, 'pattern_counts': {'":': 1, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '640894', 'license': 'BSD-3-Clause-LBNL', 'n_tokens_mistral': 743, 'n_tokens_neox': 709, 'n_words': 275, 'path': 'automatminer/examples/MSE_Example.ipynb', 'repo_name': 'ADA110/automatminer', 'size': '2517'}