Skip to content

Instantly share code, notes, and snippets.

@krishnanraman
Created January 30, 2014 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krishnanraman/8700505 to your computer and use it in GitHub Desktop.
Save krishnanraman/8700505 to your computer and use it in GitHub Desktop.
def scale(x:Data) = {
val scaler = x.max - x.min
val min = x.min
(x.map { i => (i-min)/scaler }, min, scaler)
}
@sx2008
Copy link

sx2008 commented Jun 15, 2015

a little speedup for free... maybe 20% :-)

def scale(x:Data) = {
    val min = x.min
    val scaler = x.max - min
    (x.map { i => (i-min)/scaler }, min, scaler)
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment