예제 #1
0
파일: ia.py 프로젝트: NatanJMai/IA
def main():
  res    = taskMain()
  aux1   = [] 
  cont   = 0
  setS = [10.0,12.0,19.0,2.0,22.0,29.0]
  setR = [39.0,30.0,42.0,43.0,48.0,49.0]
  
  for i in filterSet(res, setR, setS):
    j = Fish()
    j.createFish(i.name, i.light, i.length, i.descr)
    aux1.append(j)
  
  fishes  = filterSet(res, setR, setS)
  fishes1 = finalCalc(fishes)
  
  cont = diff(aux1, fishes1)
  print("%d diferencas" % cont)
예제 #2
0
파일: k_means.py 프로젝트: NatanJMai/IA
  totalC = 0
  nr     = 0
  a      = 0
  b      = 0
  for i in setFish:
    if i.tipo == "B":
      nr += 1
      totalL += i.light
      totalC += i.length

  if nr != 0:
    a = totalL / nr
    b = totalC / nr
  
    clusterB.center = (a, b)


if __name__ == "__main__":
  p1 = (1.4, 21)
  p2 = (10.2, 17)
  
  global clusterA
  global clusterB
  clusterA = Cluster()
  clusterB = Cluster()
  clusterA.createCluster(Type.N, "A", [], p1)
  clusterB.createCluster(Type.N, "B", [], p2)

  setFish  = taskMain()
  main(p1, p2)