# AI-Portal Artificial Intelligence for Enthusiasts

## Genetically evolved images Part 2

Once we have defined our image representation, we can define the Image Space.

We can represent our images as trees, having a node as a function, and the operands as leaves. In this way , a more complicated image can be represented as a deeper tree, given example sin(cos(x) + y), we have the sine as root, the leaf is a plus function, which is a node having as first leaf a cosine node with a single leaf x, and the other leaf a single leaf y.

After that, we can begin to define the distance between two given images, with respect to a given distance measurement function F, in the following way:

d(i1 , i2) = F(i1 , i2)

The distance measurement function requires a list of common subtrees for the two images, which will be weightily evaluated.

We have three proposals for different distance measurement functions.

F1 = Sum (width * height * (1 / (distance to root + 1) )

F1 sums for all common subtrees, the value given by width of the subtree, its height, and 1 divided by its distance to root plus 1.

F2 = Sum (length^2 * index)

F1 sums for all common subtrees, the value given by length of subtree multiplied by its index in the common subtree list.

F3 = Sum (length * height)

We can observe that F1 is directly proportional with image complexity, as in it grows in value when the complexity grows, so comparing two simple images will result in lower values for F1, even though the images might be much more similar than ones very complex, but with a lot of common subtrees.

F2 is highly dependant on the order in which the algorithm that finds common subtrees (namely simple BF for example) indexes them.

F3 seems to be the most independent function.

Given three axes in the tridimensional Image Space, each axis representing a given value of the corresponding F function, we can place each image at a given point, starting from a reference point of a base function that we use. Further, there can be defined the Space of the Image spaces, considering that each Space can begin from a different base function. We notice that in this case simple images have a tendency to agglomerate in galaxies near the center point if they have nothing or little numbers of common subtrees with the given base function.

Note that each image is then represented as a relative distance to another, and the functions are not transitive nor having addition rules ( F1 ( i1 , i2 )  !=  F1( i1 , i3 )  +  F1( i3 , i2 ) ).