Scipy causes penalty each turn

Hey C1 Team,

the last days I did some experiments with some “lazy training” approaches. I know that they are time cosuming but I’m pretty sure that they fit some of my ideas. So I started to implement a own function for the euclidean distance.

> # calculate the Euclidean distance between two vectors
> def _euclidean_distance(self, row1, row2):
>         distance = 0.0
>         for i in range(len(row1)-1):
>             distance += (row1[i] - row2[i])**2
>         return sqrt(distance)

this methode takes 4,5 - 5 seconds with my training data. So I started to implement the euclidean with scipy because it is more preformant.

> from scipy.spatial import distance
> distance.euclidean(row1, row2)

this approach takes only 2 seconds.

Now, I uploaded one Algo with Scipy and I got a penalty each turn. I uploaded another algo and used my own implementation of Euclidean and get no penalty.

Greetings!

The penalty comes from to much train data. I reached the computing limit. I reduced the dimenstion and the dataset and the code works with and without scipy. This is no Bug!

Not sure what you are trying to do … but you know you can cash this right ?

Assuming you are using this for targeting:
If you represent first location always as 0:0, and location two as “offset” -5:1
Then limit the search only to the max unit.range from the config, currently 5.
And reduce the calculation 4 more times, by calculating only the “positive” quadrant, and reusing the results distance(5,1) == distance (-5,1) == distance(5,-1) == distance (-5, -1)