Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. private var weights : DoubleArray
  2. private var bias = 0.0
  3.  
  4. // numFeatures is a value of type Int and refers to the number of features.
  5. // It is the length of the X vector.
  6.  
  7. init {
  8. val random = Random()
  9. val weights = DoubleArray(numFeatures)
  10. for (x in 0 until numFeatures) {
  11. weights[x] = random.nextFloat().toDouble()
  12. }
  13. this.weights = weights
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement