Skip to content

Instantly share code, notes, and snippets.

@shubham0204
Created June 9, 2019 06:25
Show Gist options
  • Select an option

  • Save shubham0204/c4c4a874bbf86c84b1921275aac34e60 to your computer and use it in GitHub Desktop.

Select an option

Save shubham0204/c4c4a874bbf86c84b1921275aac34e60 to your computer and use it in GitHub Desktop.
fun fit ( x : Array<DoubleArray> , y: DoubleArray , epochs : Int , batchSize: Int ) {
val batches = batch( x , y , batchSize )
for ( e in 0 until epochs ) {
for ( batch in batches ) {
val gradients = ArrayList<Array<Any>>()
for ( pair in batch ) {
val predictions = forwardPropogate( pair.first )
gradients.add( calculateGradients( pair.first , predictions , pair.second ) )
}
optimizeParameters( gradients , 0.001 )
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment