(approx, data)
| 46 | return math.pow(popul, 1 / base) * mult |
| 47 | |
| 48 | def avgDistance(approx, data): |
| 49 | dist = 0 |
| 50 | for x in xrange(len(data)): |
| 51 | dist += math.fabs(approx[x] - data[x]) |
| 52 | return dist / float(len(data)) |
| 53 | |
| 54 | def findBest(popul, data, minBase = 5, maxBase = 100, stepBase = 0.1, minMult = 0.01, maxMult = 1, stepMult = 0.01): |
| 55 |