From 51f084d28be21118c403ce5ae29775ab894971ae Mon Sep 17 00:00:00 2001 From: Roland Grinis Date: Wed, 28 Apr 2021 17:07:10 +0100 Subject: [PATCH] merge PR --- .../main/kotlin/space/kscience/kmath/tensors/OLSWithSVD.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/src/main/kotlin/space/kscience/kmath/tensors/OLSWithSVD.kt b/examples/src/main/kotlin/space/kscience/kmath/tensors/OLSWithSVD.kt index a9b154017..9318fe928 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/tensors/OLSWithSVD.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/tensors/OLSWithSVD.kt @@ -30,20 +30,17 @@ fun main() { println("Real alpha:\n$alpha") - // also take sample of size 20 from normal distribution for x TODO rename + // also take sample of size 20 from normal distribution for x val x = randNormal( intArrayOf(20, 5), randSeed ) // calculate y and add gaussian noise (N(0, 0.05)) - // TODO: please add an intercept: Y = beta * X + alpha + N(0,0.5) val y = x dot alpha y += y.randNormalLike(randSeed) * 0.05 // now restore the coefficient vector with OSL estimator with SVD - // TODO: you need to change accordingly [X 1] [alpha beta] = Y - // TODO: inverting [X 1] via SVD val (u, singValues, v) = x.svd() // we have to make sure the singular values of the matrix are not close to zero