20.07.13 23:22, pablobarhamal...@gmail.com написав(ла):
         e = math.e

         count = -1
         for x in range(hidden_num):
             temp = 0
             for y in range(input_num):
                 count += 1
                 temp += inputs[y] * h_weight[count]
             hidden[x] = 1/(1+e**(-temp))
[...]
My question to you is if you an see any obvious (or not so obvious) way of 
making this faster.

1. Use math.exp() instead of math.e**.

2. I'm not sure that it will be faster, but try to use sum().

  temp = sum(inputs[y] * h_weight[count + y] for y in range(input_num))
  count += input_num

or

  temp = sum(map(operator.mul, inputs, h_weight[count:count+input_num]))
  count += input_num


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to