Skip to content

Commit a1c4bfa

Browse files
zhengshuimontanaflynn
authored andcommitted
fix: remove unused sum[4] in LinearRegression
The sum[4] variable was being calculated but never used in the LinearRegression function. This removes the unnecessary computation and changes the sum array size from [5] to [4]. Fixes #85
1 parent b267a10 commit a1c4bfa

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

regression.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func LinearRegression(s Series) (regressions Series, err error) {
1818
}
1919

2020
// Placeholder for the math to be done
21-
var sum [5]float64
21+
var sum [4]float64
2222

2323
// Loop over data keeping index in place
2424
i := 0
@@ -27,7 +27,6 @@ func LinearRegression(s Series) (regressions Series, err error) {
2727
sum[1] += s[i].Y
2828
sum[2] += s[i].X * s[i].X
2929
sum[3] += s[i].X * s[i].Y
30-
sum[4] += s[i].Y * s[i].Y
3130
}
3231

3332
// Find gradient and intercept

0 commit comments

Comments
 (0)