Skip to content

Instantly share code, notes, and snippets.

@ShuaiGuo16
Created January 23, 2021 21:20
Show Gist options
  • Save ShuaiGuo16/8c087bb16931a917e25d3912fe0a7b5c to your computer and use it in GitHub Desktop.
Save ShuaiGuo16/8c087bb16931a917e25d3912fe0a7b5c to your computer and use it in GitHub Desktop.
GP prediction score
def score(self, X_test, y_test):
"""Calculate root mean squared error
Input
-----
X_test: test set, array of shape (n_samples, n_features)
y_test: test labels, array of shape (n_samples, )
Output
------
RMSE: the root mean square error"""
y_pred, SSqr = self.predict(X_test)
RMSE = np.sqrt(np.mean((y_pred-y_test)**2))
return RMSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment