Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Tafkas
Created November 25, 2013 14:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Tafkas/7642141 to your computer and use it in GitHub Desktop.
Save Tafkas/7642141 to your computer and use it in GitHub Desktop.
Compute the Root Mean Squared Log Error for hypothesis h and targets y
import numpy as np
def rmsle(h, y):
"""
Compute the Root Mean Squared Log Error for hypthesis h and targets y
Args:
h - numpy array containing predictions with shape (n_samples, n_targets)
y - numpy array containing targets with shape (n_samples, n_targets)
"""
return np.sqrt(np.square(np.log(h + 1) - np.log(y + 1)).mean())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment