Reduce public api of orx-gradient-descent
This commit is contained in:
@@ -28,14 +28,13 @@ import kotlin.math.max
|
|||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
fun ten(a: DoubleArray, b: DoubleArray): Array<DoubleArray> = Array(a.size) { mul(b, a[it]) }
|
private fun ten(a: DoubleArray, b: DoubleArray): Array<DoubleArray> = Array(a.size) { mul(b, a[it]) }
|
||||||
fun max(a: Double, b: Double, c: Double): Double = max(max(a, b), c)
|
private fun max(a: Double, b: Double, c: Double): Double = max(max(a, b), c)
|
||||||
|
|
||||||
fun max(a: Double, b: Double, c: Double, d: Double, e: Double, f: Double, g: Double, h: Double): Double {
|
private fun max(a: Double, b: Double, c: Double, d: Double, e: Double, f: Double, g: Double, h: Double): Double {
|
||||||
return max(max(max(max(max(max(max(a, b), c), d), e), f), g), h)
|
return max(max(max(max(max(max(max(a, b), c), d), e), f), g), h)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun gradient(x: DoubleArray, objective: (parameters: DoubleArray) -> Double): DoubleArray {
|
fun gradient(x: DoubleArray, objective: (parameters: DoubleArray) -> Double): DoubleArray {
|
||||||
var k = 0
|
var k = 0
|
||||||
val tempX = x.copyOf()
|
val tempX = x.copyOf()
|
||||||
@@ -69,7 +68,6 @@ fun gradient(x: DoubleArray, objective: (parameters: DoubleArray) -> Double): Do
|
|||||||
k++
|
k++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//println("gradient at (${x.contentToString()}) -> (${grad.contentToString()}) ")
|
|
||||||
return grad
|
return grad
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user