We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9aa744 commit 797fd0aCopy full SHA for 797fd0a
Linear Regression/README.markdown
@@ -57,12 +57,12 @@ func predictedCarPrice(carAge: Double) -> Double {
57
Now for the code which will perform the iterations:
58
59
```swift
60
-let numberOfCarAdvertsWeSaw = carPrice.count - 1
+let numberOfCarAdvertsWeSaw = carPrice.count
61
let iterations = 2000
62
let alpha = 0.0001
63
64
for n in 1...iterations {
65
- for i in 0...numberOfCarAdvertsWeSaw {
+ for i in 0..<numberOfCarAdvertsWeSaw {
66
let difference = carPrice[i] - predictedCarPrice(carAge[i])
67
intercept += alpha * difference
68
slope += alpha * difference * carAge[i]
0 commit comments