<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="et">
	<id>http://www.lambda.ee/w/index.php?action=history&amp;feed=atom&amp;title=Ifi6057Perceptron</id>
	<title>Ifi6057Perceptron - Redigeerimiste ajalugu</title>
	<link rel="self" type="application/atom+xml" href="http://www.lambda.ee/w/index.php?action=history&amp;feed=atom&amp;title=Ifi6057Perceptron"/>
	<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Ifi6057Perceptron&amp;action=history"/>
	<updated>2026-10-28T14:20:34Z</updated>
	<subtitle>Selle lehekülje redigeerimiste ajalugu</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Ifi6057Perceptron&amp;diff=12902&amp;oldid=prev</id>
		<title>PriitJ: Uus lehekülg: &#039; class Perceptron:                                                                  def __init__(self, w=[1], t=0.5):                                                  self.weight...&#039;</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Ifi6057Perceptron&amp;diff=12902&amp;oldid=prev"/>
		<updated>2015-11-23T12:53:58Z</updated>

		<summary type="html">&lt;p&gt;Uus lehekülg: &amp;#039; class Perceptron:                                                                  def __init__(self, w=[1], t=0.5):                                                  self.weight...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Uus lehekülg&lt;/b&gt;&lt;/p&gt;&lt;div&gt; class Perceptron:                                                               &lt;br /&gt;
  def __init__(self, w=[1], t=0.5):                                             &lt;br /&gt;
    self.weights = w                                                            &lt;br /&gt;
    self.threshold = t                                                          &lt;br /&gt;
                                                                                &lt;br /&gt;
  def classify(self, values):                                                   &lt;br /&gt;
    s = sum(value * weight for value, weight in                                 &lt;br /&gt;
      zip(values, self.weights))                                                &lt;br /&gt;
    return s &amp;gt; self.threshold                                                   &lt;br /&gt;
                                                                                &lt;br /&gt;
  def train(self, trainset, lrate):                                             &lt;br /&gt;
    beste = len(trainset) + 1                                                   &lt;br /&gt;
    bestv = [ w for w in self.weights ]                                         &lt;br /&gt;
    noupdate = 0                                                                &lt;br /&gt;
    while noupdate &amp;lt; 1000:                                                      &lt;br /&gt;
      errors = 0                                                                &lt;br /&gt;
      for vect, val in trainset:                                                &lt;br /&gt;
        result = self.classify(vect)                                            &lt;br /&gt;
        error = val - result                                                    &lt;br /&gt;
        if error != 0:                                                          &lt;br /&gt;
          errors += 1                                                           &lt;br /&gt;
          for i, v in enumerate(vect):                                          &lt;br /&gt;
            self.weights[i] += lrate * error * v                                &lt;br /&gt;
      if errors &amp;lt; beste:                                                        &lt;br /&gt;
        print (errors,self.weights)                                             &lt;br /&gt;
        beste = errors                                                          &lt;br /&gt;
        bestv = [ w for w in self.weights ]                                     &lt;br /&gt;
        noupdate = 0                                                            &lt;br /&gt;
      else:                                                                     &lt;br /&gt;
        noupdate += 1                                                           &lt;br /&gt;
      if errors == 0:                                                           &lt;br /&gt;
        break                                                                   &lt;br /&gt;
    print (&amp;quot;Training done with best case: &amp;quot;, beste, bestv)                      &lt;br /&gt;
    print (&amp;quot;Current: &amp;quot;, errors, self.weights)                                   &lt;br /&gt;
    self.weights = bestv&lt;/div&gt;</summary>
		<author><name>PriitJ</name></author>
	</entry>
</feed>