diff --git a/learning.py b/learning.py index 0894b2190..5db41efa5 100644 --- a/learning.py +++ b/learning.py @@ -647,15 +647,14 @@ def Linearlearner(dataset, learning_rate=0.01, epochs=100): err = [] # Pass over all examples for example in examples: - x = [example[i] for i in range(idx_i)] - x = [1] + x + x = [1] + example y = dotproduct(w, x) t = example[idx_t] err.append(t - y) # update weights for i in range(len(w)): - w[i] = w[i] - dotproduct(err, X_col[i]) + w[i] = w[i] - learning_rate * dotproduct(err, X_col[i]) def predict(example): x = [1] + example pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy