stat: reduce rendered precision of LinearRegression example

This commit is contained in:
Dan Kortschak
2020-01-13 14:27:07 +10:30
parent 139a027f55
commit 2d18c7e915

View File

@@ -34,12 +34,12 @@ func ExampleLinearRegression() {
alpha, beta := stat.LinearRegression(xs, ys, weights, origin)
r2 := stat.RSquared(xs, ys, weights, alpha, beta)
fmt.Printf("Estimated slope is: %v\n", alpha)
fmt.Printf("Estimated offset is: %v\n", beta)
fmt.Printf("R^2: %v\n", r2)
fmt.Printf("Estimated slope is: %.6f\n", alpha)
fmt.Printf("Estimated offset is: %.6f\n", beta)
fmt.Printf("R^2: %.6f\n", r2)
// Output:
// Estimated slope is: 0.988572424633503
// Estimated offset is: 3.0001541344029676
// R^2: 0.9999991095061128
// Estimated slope is: 0.988572
// Estimated offset is: 3.000154
// R^2: 0.999999
}