diff --git a/learning.py b/learning.py index 981a557c2..2e53f1e99 100644 --- a/learning.py +++ b/learning.py @@ -635,6 +635,7 @@ def LinearLearner(dataset, learning_rate=0.01, epochs=100): idx_i = dataset.inputs idx_t = dataset.target # As of now, dataset.target gives only one index. examples = dataset.examples + num_examples = len(examples) # X transpose X_col = [dataset.values[i] for i in idx_i] # vertical columns of X @@ -657,7 +658,8 @@ def LinearLearner(dataset, learning_rate=0.01, epochs=100): # update weights for i in range(len(w)): - w[i] = w[i] - learning_rate * dotproduct(err, X_col[i]) + w[i] = w[i] + learning_rate * (dotproduct(err, X_col[i]) / num_examples) + 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