# What is the process to calculate Mean Square Error in Python

For a prediction model, I need to calculate Mean square Error which will take into consideration the prediction of the developed model in python. Below is the code Can anyone help me into this ?

```
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
# load data
df_bridge = pd.read_csv ("bridge_data.csv")
# categorize data
X = df_bridge.drop("8 - Structure Number", axis=1).drop("43A - Main Span Material", axis=1)
X = X.values
y = df_bridge["8 - Structure Number"]
y = y.values
# Split into training and test set
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state=42)
# Apply the Prediction KNN model
knn = KNeighborsClassifier(n_neighbors=7)
knn.fit(X_train, y_train)
```