Skip to content

Instantly share code, notes, and snippets.

@shubham0204
Created June 9, 2019 05:55
Show Gist options
  • Save shubham0204/e0143179726732b9c3fddac5740328cb to your computer and use it in GitHub Desktop.
Save shubham0204/e0143179726732b9c3fddac5740328cb to your computer and use it in GitHub Desktop.
private var weights : DoubleArray
private var bias = 0.0
// numFeatures is a value of type Int and refers to the number of features.
// It is the length of the X vector.
init {
val random = Random()
val weights = DoubleArray(numFeatures)
for (x in 0 until numFeatures) {
weights[x] = random.nextFloat().toDouble()
}
this.weights = weights
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment