<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dw="https://www.dreamwidth.org">
  <id>tag:dreamwidth.org,2011-04-08:763339</id>
  <title>fandaal</title>
  <subtitle>fandaal</subtitle>
  <author>
    <name>fandaal</name>
  </author>
  <link rel="alternate" type="text/html" href="https://fandaal.dreamwidth.org/"/>
  <link rel="self" type="text/xml" href="https://fandaal.dreamwidth.org/data/atom"/>
  <updated>2011-07-28T17:26:08Z</updated>
  <dw:journal username="fandaal" type="personal"/>
  <entry>
    <id>tag:dreamwidth.org,2011-04-08:763339:2461422</id>
    <link rel="alternate" type="text/html" href="https://fandaal.dreamwidth.org/2461422.html"/>
    <link rel="self" type="text/xml" href="https://fandaal.dreamwidth.org/data/atom/?itemid=2461422"/>
    <title>fandaal @ 2011-07-28T20:23:00</title>
    <published>2011-07-28T17:26:08Z</published>
    <updated>2011-07-28T17:26:08Z</updated>
    <category term="python"/>
    <category term="code"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">ну вот и пригождается этот блог.&lt;br /&gt;жж висит с переменным успехом уже долго..&lt;br /&gt;&lt;pre&gt;
#classification
import math
class Predmet:
    def __init__():
        return
class Category(Predmet):
    pass
def Proto():#cathegory prototype calculation
    return
def Exemplar(m,n):#n is number of attributes, m is a range of attribute
    import random
    a=[]
    for i in range(n):
        a.append(random.randint(0,m))
    return a
def Distance(d,f):#calculates the distance between 2 exemplars
    dis=0
    for i in range(len(d)-1):
        dlin=(d[i]-f[i])*(d[i]-f[i])
        dis=dis+dlin
    return math.sqrt(dis)
def AverageDis(vid):
    aw=0
    for i in range(len(vid)-1):
        aw=aw+Distance(vid[i],vid[i+1])
    return aw/(len(vid))
        
c=3
cat=[]
klas=[]
while c&amp;gt;0:
    b=Exemplar(5,10)
    print(b)
    c=input()
    c=int(c)
    if c==1:
        cat.append(b)
    if c==2:
            klas.append(b)
print('first category')
print(cat)
print('second category')
print(klas)
print('distances between first category first two objects')
print(Distance(cat[0],cat[1]))
print('Average distances between 1 cat objects')

    
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=fandaal&amp;ditemid=2461422" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
</feed>
