Created
January 23, 2021 21:20
-
-
Save ShuaiGuo16/8c087bb16931a917e25d3912fe0a7b5c to your computer and use it in GitHub Desktop.
GP prediction score
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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