• No results found

Solving geometric analogy problems using complexity

N/A
N/A
Protected

Academic year: 2021

Share "Solving geometric analogy problems using complexity"

Copied!
38
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Solving geometric analogy

problems using complexity

(2)

Layout: typeset by the author using LATEX.

(3)

Solving geometric analogy problems using

complexity

Barbara Brocades Zaalberg 11060271

Bachelor thesis Credits: 18 EC

Bachelor Kunstmatige Intelligentie

University of Amsterdam Faculty of Science Science Park 904 1098 XH Amsterdam Supervisor dr. G. Sileno Informatics Institute Faculty of Science University of Amsterdam Science Park 904 1098 XH Amsterdam July 13th, 2020

(4)

Abstract

Analogical reasoning plays an important role in many of our cognitive functions. In an essential form, an analogy is a problem of the form A is to B what C is to D, where D is unknown and must be inferred. This research focuses in particular on geometric analogy problems. In order to study the underlying cognitive functions necessary to solve these problems, a certain level of abstraction is used in the representation of an analogy. A solution is then given in terms of a process that transforms A in B and C in D. To construct such a transformation, insights from complexity theory and structure mapping theory are taken to design a compressor that finds the internal organisation of the input objects, and process it in order to create the output object. Five geometric analogy problems were solved using this method. This method also confirmed that the best encoding of the input is the one with the lowest description complexity.

(5)

Contents

1 Introduction 1 1.1 Relevance . . . 1 1.2 Aim . . . 1 1.3 Plan of document . . . 2 2 Theoretical Foundation 3 2.1 Compression as a means for abstraction . . . 3

2.2 Complexity as a measure of intelligence . . . 4

2.2.1 Kolmogorov Complexity . . . 4

2.2.2 Intelligence tests . . . 4

2.2.3 Complexity and intelligence . . . 5

2.3 Contrast Operation . . . 5

2.4 Structure Mapping-Theory . . . 6

3 Research 7 3.1 Analogies from Evans (1968) . . . 7

3.2 Method . . . 7 3.2.1 Objects . . . 8 3.2.2 Arrangements . . . 8 3.2.3 Operators . . . 9 3.2.4 Procedure . . . 9 3.3 Complexity assignment . . . 13 4 Results 15 4.1 Results analogy 2 . . . 15 4.2 Analogy 3 . . . 16 4.3 Analogy 4 . . . 17 4.4 Analogy 5 . . . 18 4.5 Analogy 14 . . . 19

5 Evaluation and discussion 21 5.1 Limitations of the compressor . . . 21

5.2 Comparison with solution by Lovett et al. . . 27

5.3 Other remarks . . . 27

6 Conclusion 29

Bibliography 30

Appendices 32

(6)

Chapter 1

Introduction

1.1

Relevance

Analogical reasoning is an important mental ability which contributes to human intelligence. It involves a comparison between two objects or concepts in which the focus lies on the alleged similarities between a base (or source) domain, that provides the knowledge, and the target domain, that is being understood. We use analogies everywhere in our daily life, to learn new information and guide our understanding of new concepts using better known ideas. It has been studied that analogical reasoning plays a role in a variety of cognitive processes such as decision making, generalization, memory, conceptualization and problem solving. As such it is an often recurring component in intelligence tests such as the Raven’s Progressive Matrices (Raven, 2000) (see Appendix A). This makes it an interesting research topic both within cognitive sciences as well as in artificial intelligence.

As the name suggests analogical reasoning is a way of thinking that involves some form of analogy. Schematically, an analogy can be written as a rule of the form ”A is to B what C is to D” or A:B :: C:D. In analogy tests D is an unknown item and participants are asked to come up with D or choose the most appropriate D from a set of options. Note that a comparison by analogy is different from a comparison by literal similarity. In a literal similarity comparison the base and the target have a large degree of overlap not only in the relational structures between their components but also in the individual attributes of their components. As such literal similarity comparisons are not very useful to learn new concepts be-cause the base and the target are too similar to extract new information from their comparison. In theory there are infinitely many similarities to be found between two objects, so the quality of a solution to an analogy is also a question of relevance. In this research, the comparison in an analogy is based upon the relational structures between components only, with few to no similarities between object attributes. This approach is based on the Structure-Mapping Theory by Gentner for explaining analogies (Gentner, 1983). Many proposed frameworks to model analogical reasoning are based on complex calculations and require a relevant amount of computing power (Evans, 1968; Hofstadter and Mitchell, 1994). However these types of solutions don’t resemble the way humans reason. A different approach is to describe analogy problems in terms of complexity and look at their solution as a complexity minimization problem. This approach was taken by Murena et al. (2017) to solve Hofstadter’s analogies (where items of the analogy are strings of characters) and is inspired by the well-known philosophical principle of Occam’s razor, stating that the best solution is the simplest one. Expressing analogies in terms of their complexity can explain why humans are better at solving one analogy over another because analogies that are experienced as difficult have a complex pattern that is not so easily discovered.

1.2

Aim

In this research the focus lies on geometric analogy problems. These are visual analogy problems involv-ing basic geometric shapes like lines, squares and circles. Participants in a geometric analogy test are presented with three images, A, B and C, and are asked to choose an image D that best completes the sequence from a set of five candidate images, see figure 1.1.

This research combines insights from structure-mapping theory and complexity theory to solve ge-ometric analogy problems in a manner that resembles the human approach. Structure mapping and

(7)

CHAPTER 1. INTRODUCTION

Figure 1.1: Example of a geometric analogy problem

complexity minimization will guide the search of a best solution. Additionally the description length of the best solution will serve as a measure of complexity.

1.3

Plan of document

To be able to analyse geometric analogies and find the structural mapping between the base and the target domain, the input objects will be described in an easily processable model that abstracts away from the actual visual pixel input. Therefore each image in the analogy will be described as an arrangement (see 3.2.2) consisting of objects (see 3.2.1) with certain attributes (such as center, size and rotation) and relations between objects (such as isLeftOf(object1, object2)).

A method, functionally behaving as a compressor, will then be designed that finds the transformation between the input arrangements in the base domain, A and B. This transformation is than applied to the first arrangement in the target domain, C, to obtain the final arrangement D. The role of the compressor is thus to find a certain encoding of the input. Writing C in this encoding and then decompressing this should produce D, the final part of the analogy. To go back from the qualitative description of D to the visual image D, the arrangement D can be exported as visual image again using a SVG format (scalable vector graphic). The complexity of solution D will be compared to the human average response time on that problem.

(8)

Chapter 2

Theoretical Foundation

2.1

Compression as a means for abstraction

Compression and abstraction are two concepts that are closely related. The term compression in computer science refers to the action of reducing the size of some data by encoding it with fewer bits. In this way the length of the information is shortened so it needs less storage space and is easier to transfer. An algorithm or program that compresses data is called a compressor, the algorithm or program that inverts this process is called a decompressor. Lossless compression means that some information about the data is hidden, but not lost since the full length of the information can be recovered by decompressing the result of the compressor. Lossy compression means that to some degree information will be lost upon decompression, but the result is still useful for the application for which it is needed. An example of how a (lossless) compression of a character string works (by using an iteration operator *) is shown in listing 2.1.§ > > > c h a r _ s t r i n g = A A A A A A > > > c o m p r e s s ( c h a r _ s t r i n g ) 6* A > > > d e c o m p r e s s ( c o m p r e s s ( c h a r _ s t r i n g ) ) A A A A A A

Listing 2.1: Example compressor

At higher-level, compression can be seen as a tool to obtain abstraction (identifying structurally relevant features); vice-versa an abstraction can be the outcome of a compression process. Abstraction is used when the goal is to create a more general notion of a particular concept or phenomenon. The information load is reduced in order to maintain only those attributes that are relevant for the objective at hand. There is a loss of information, but this is necessary to reason about the concept or phenomenon without maintaining unnecessary specific or in-depth knowledge about it.

Developing methods that use abstraction/compression is useful because it makes them better appli-cable in different domains. This approach is for example taken by Li et al. to determine the evolutionary distance between species, not by looking at their biological similarities but by concatenating and com-pressing their genomes (Li et al., 2004).

This research follows a similar intuition. In order to reason about geometric analogies in a more abstract way, compression is used to abstract away from the actual visual geometric objects and their attributes. This makes the algorithm able to, for example, compare an image A of a triangle and a circle with an image B of a rectangle and a line. To compare these hypothetical images A and B, a compressor needs to be designed so that it ‘reads’ the input organisation. The compressor finds a certain encoding of the input data, which is then the compressed representation of the input. Finding the best compression of the input objects is equal to understanding the organisation of the input. The best analogy would be the one which compresses best with the different inputs.

(9)

CHAPTER 2. THEORETICAL FOUNDATION

2.2

Complexity as a measure of intelligence

This section will discuss what complexity is and why complexity can serve as a good measure of intelli-gence.

2.2.1

Kolmogorov Complexity

Definitions of complexity often depend on the area in which they are used. In theoretical computer science and mathematics, an often used notion for complexity is Kolmogorov Complexity, proposed by Andrei Kolmogorov (Li et al., 2008). Informally, the Kolmogorov complexity of an object is the length of the shortest computer program that can produce that object.1An object can for example be a sequence of bits, in which case Kolmogorov Complexity is also a measure of randomness. The assumption is that the shortest description of a truly random sequence will be the sequence itself while a non-random sequence will be regular and can thus be easily described in a way that is much shorter than the sequence itself. To express it in terms of compression, a truly random sequence is incompressible and thus has a high complexity. The Kolmogorov complexity depends on what we mean by program and on what kind of machine this program runs. The formal definition of Kolmogorov complexity is:

K(x) := min

p {l(p) : U (p) = x}

where x is a finite bitstring and K(x) is the Kolmogorov complexity of that bitstring. The binary string p is the program that produces x, and l(p) is the length of that program in bits. Finally, U is a optimal universal Turing machine that runs the program p, meaning that p produced by machine U is the shortest possible description or ideal compression of x.

Although Kolmogorov complexity is formally well-defined and used in theoretical computer science, a drawback of this notion is that it’s in reality uncomputable. This is because to find the shortest program that can produce an arbitrary string x, possibly infinitely many programs must be compared that produce x to be able to decide which one is the shortest. However it can never be guaranteed that the shortest description is found. In addition to this, some of these programs might never stop executing, which is know as the non-computability of the halting problem. Nonetheless, when the appropriate restrictions are taken, K(x) can be approximated and can still serve as a useful measure of complexity. One of these restrictions is that the underlying machine producing the program to create the sequence is not a Universal Turing machine but a machine that has a finite set of operators and memory. (Li et al., 2008)

2.2.2

Intelligence tests

One of the central goals in Artificial Intelligence is creating intelligent machines. However, what intelli-gence is exactly and how it should be measured stays a much debated topic. Over the years many tests to measure intelligence in humans have been designed, such as Raven’s progressive matrices (Raven, 2000) or the Stanford-Binet test (Terman and Merrill, 1960). There is general consensus that most of these tests measure something useful in humans which is stable over time and accurately predicts an individuals academic performance in life (Gottfredson, 1997). However, not everyone is on the same page about if what these tests measure is indeed intelligence, just a part of it, or actually something else. Moreover, most of these test are not applicable on machines the way they are applicable on humans because ma-chines have a vastly different embodiment from humans or because the test has a brute-force solution, which some machines have no problem using but is not feasible for humans from a cognitive point of view. For example, having a good memory or doing well at mental arithmetic are generally considered traits of intelligence in humans. Still a human being will never be able to compete with an average computer on these fronts. However an average computer is not considered truly intelligent according to most standards. The same is true for analogies, most people will agree that being able to understand and solve analogy tasks is a sign of intelligence, hence why these type of tasks so often appear in intelligence tests. Models for solving analogies using vast amounts of computing power or complicated calculations might score better than humans, but the question should be asked if being able to solve analogies with these resources is truly a manifestation of intelligence.

Besides tests to measure human intelligence, there have also been test proposed to measure machine intelligence. The most famous one being the Turing test (TURING, 1950). Although the Turing Test is

1Note the difference from time complexity, which describes the amount of time it takes to run an algorithm. The latter

(10)

CHAPTER 2. THEORETICAL FOUNDATION

one of the most famous tests for machine intelligence, passing the Turing test is not so much a sign that a machine is intelligence as it is a sign that the machine is good at imitating human behaviour.

All the above illustrates the need for a definition of intelligence that is general enough to apply to a wide range of different entities.

2.2.3

Complexity and intelligence

Definitions of intelligence often mention cognitive skills like planning, abstract thinking, the ability to reason, problem solving, understanding complex ideas etcetera. Legg and Hutter (2007) consider intel-ligence as the outcome rather than the source of such skills. This means that intelintel-ligence is not tied to human cognitive capacities, intelligence can well be the outcome of another set of skills that humans don’t possess. In an approach to settle the debate around machine intelligence, Legg & Hutter have come up with the following definition of machine intelligence:

"Intelligence measures an agent’s ability to achieve goals in a wide range of environments.".

Given the situation that the environment is unknown to the agent, so he only knows about past envi-ronments. With the knowledge from past observations the agents can construct certain hypotheses that are consistent with the observations about the current environment. Now, there are logically very many hypotheses about the current situation that are consistent with the current data. The question is than how to measure the performance of an agent in such a situation, how can the agent choose the hypothesis that is most likely to be true. The answer is to apply Occam’s razor:

"Given multiple hypotheses that are consistent with the data, the simplest should be preferred."(Legg and Hutter, 2007)

The ability to use Occam’s razor is a sign of intelligence. This is also implicit in many intelligence test, take Hofstadter’s analogies an raven progressive matrices. From this follows that intelligence can be the result of being able to deal with complexity. Occam’s razor is applied with respect to the complexity of the hypotheses. The complexity of the hypotheses depends on the complexity of the true environment. When it is a complex environment, the simplest hypotheses will also be complex. Applied to problems this means that difficult problems are complex i.e. they require a complex solution even when applying Occam’s razor while easy problems are simple.

2.3

Contrast Operation

In geometric analogy tests, to be able to decide on the most plausible image D to complete the pat-tern, first arrangement A and arrangement B must be compared to find the transformation between them. Once a transformation is found, this transformation must be applied on arrangement C to produce arrangement D. In order to find a transformation between arrangements, the differences between the arrangements need to be laid out. Then to decide on which objects in C the transformation should be applied, a mapping between the objects in A and the objects in C should be determined. This can both be done using a contrast operation.

Comparing any two distinct items means that there are a lot of differences to be found, but given the context of their comparison not all those differences are interesting to get a measure of their similarity (Tversky, 1977). When comparing an apple with a bag of crisps for example, one could point out their difference in color, size, denseness etc. But in the context of comparing an apple with a bag of crisps for their nutritional values, the contrast results in a vector that indicates all dimensions in which the objects differ where each entry stands for a different nutritional value such as fats and carbs.

Contrast corresponds to an operation that takes out all the differences between two items according to all the dimensions relevant in the comparison of those items (Dessalles, 2015). Comparing any two distinct items means that there are a lot of differences to be found, and, at least descriptively, the most contrastive dimensions becomes the more accessible. More in general, given the context of their com-parison not all those differences are interesting to get a measure of their similarity. When comparing an apple with a bag of crisps for example, one could point out their difference in color, size, denseness etc. But in the context of comparing an apple with a bag of crisps for their nutritional values, the contrast

(11)

CHAPTER 2. THEORETICAL FOUNDATION

results in a vector that indicates all dimensions in which the objects differ where each entry stands for a different nutritional value such as fats and carbs.

In this research, the contrast will take place in two different contexts. One where the contrast is between arrangements and the contrast is taken between the structural relations between objects, the other where the contrast is between individual objects and the contrast is taken between the attributes of objects.

2.4

Structure Mapping-Theory

The structure mapping theory is a theory formulated by Gentner to model human analogical reason-ing (Gentner, 1983). It states that analogical reasonreason-ing is different from other kinds of reasonreason-ing with comparisons because in analogical reasoning it is not the amount of shared features between base and target that defines the strength of the comparison, but the amount of shared relationships between them. This means that it is not the domain specific information that counts in interpreting an analogy, but the syntactic properties of knowledge representation. Objects have attributes and relationships. Attributes are object specific features whereas relationships are propositions about objects. Attributes can there-fore be seen as one-positional predicates, like round(X), while relationships are two-or more positional predicates, like isAbove(X, Y). According to this theory, the idea behind analogical reasoning is that relational structures between objects from one domain can be applied in another. Only relationships are mapped from base to target. This explains why not all features are equally relevant to an analogy. Consider the analogy "Coffee is to the body what gasoline is to a car". Why does this analogy make sense? Not because gasoline and coffee are so much alike, although one could say that they both have a distinctive smell, they’re both liquids and they’re both made from something dark brown. However we actually don’t care about the degree of overlap between coffee and gasoline. The thing that matters is the relationship that holds between coffee and bodies and gasoline and cars, this relationship being that they’re both energy providers.2 The fact that it’s not the sum of shared attributes that strengthens an analogy but the relations between objects also explains why some analogies can have multiple ’solutions’ that work. For example, ABC:ABD::IJK:IJL as analogy is equally valid as ABC:ABD::KJI:KJJ, although one might be preferred over the other (Murena et al., 2017). Structure mapping has been used in various other studies involving analogies, such as Tomai et al. (2005), Lovett et al. (2009), Lovett et al. (2010) and Lovett and Forbus (2012).

In this research, structure mapping is used to find the corresponding objects between arrangement A and C in a geometric analogy. This is needed to allow the decompressor to apply the transformation on the right objects. Structure mapping to find the corresponding objects between A and B is not useful since the transformation from A to B changes the relations between objects.

2From a biological point of view coffee is of course not an energy provider because it has no calories but still coffee is

(12)

Chapter 3

Research

3.1

Analogies from Evans (1968)

The starting point of this work were the 20 geometric analogy problems used in Tomai et al. (2005), Lovett et al. (2009) and Lovett and Forbus (2012). These problems are in turn based on geometric analogy problems from Evans (1968). See figure 3.1 for one of these analogies or see chapter 4 and 5 for all geometric analogies used in this research. The time underneath the analogy indicates the average time in seconds participants took to pick an answer. The numbers underneath the images indicate the percentage of people who have chosen that option as their answer. For a detailed description of how these experiments were conducted, see Lovett et al. (2009) section 7: Experimental study.

Figure 3.1: Analogy 3 from Tomai et al. (2005)

3.2

Method

This section will elaborate on the implementation that is designed to solve geometric analogy problems using complexity (2.2) and structure mapping theory (2.4), but first some terminology is needed.

• An analogy is a full sequence A:B :: C:D, where each uppercase letter is an arrangement composed of objects. Visual analogies are problems as those expressed in figure 4.5. Each uppercase letter stands for an image in the analogy.

• An image is one part of a visual analogy and is a composition of geometric objects labeled with A, B, C or D.

• An arrangement is the abstract datatype version of an image, also labeled with A, B, C or D. For more on arrangements see section 3.2.2.

• An object is a proper geometric shape within an arrangement. Visual objects are the actual sets of pixels that make up a distinguishable shape within a picture.

In order to have a more dedicated focus, this research has bypassed the image processing task of extracting the objects from the visual objects. The representation of images has been manually created, and the sections below explain how. To have a reference of spatial location of objects within images, it is assumed that the frame enclosing each image is 200 by 200.

(13)

CHAPTER 3. RESEARCH

3.2.1

Objects

Geometric objects fall into three classes: LineObjects, PolygonObjects and RoundObjects. When defining an object an instance from one of these three classes is made. Each class has slightly different instantiat-ing variables, this is because the objects are recreated on sight and a circle for example is easiest defined using radius and center point whereas a rectangle is easiest defined using its four corner points. Below is a more detailed description of the different classes.

LineObjects

LineObjects are any uninterrupted lines, so these are straight lines, curved lines (arcs) and lines with corners. A line may cross itself, however it can not be a closed form, this is reserved for PolygonObjects and RoundObjects. How to instantiate a LineObject is shown in the code below.1

L i n e O b j e c t ( shape <str> , [ points <tuple>])

# For e x a m p l e

o1 = L i n e O b j e c t (’ m u l t i l i n e ’, [ ( 1 3 5 , 7 5 ) , (25 ,75) , ( 2 5 , 1 2 5 ) , ( 1 3 5 , 1 2 5 ) ])

PolygonObjects

PolygonObjects are objects consisting of three or more corners with only straight lines between them, for example a square. The PolygonObjects mainly used in this research are triangles and squares. How to instantiate a PolygonObject is shown in the code below.

P o l y g o n O b j e c t ( shape <str> , [ corners <tuple>] , filling <bool>)

# For e x a m p l e

o2 = P o l y g o n O b j e c t (’ s q u a r e ’, [(62.5 , 1 3 7 . 5 ) , (137.5 , 1 3 7 . 5 ) , (137.5 , 6 2 . 5 ) , (62.5 , 6 2 . 5 ) ] , F a l s e )

RoundObject

A RoundObject is an enclosed round shape, so dots, circles and ellipses. Dots are circles with a radius of 1. The RoundObjects mainly used in this research are dots and circles. How to instantiate a RoundObject is shown in the code below.

R o u n d O b j e c t ( shape <str> , center <tuple> , radius1 <int> , radius2 <int> , filling <bool>)

# For e x a m p l e

o3 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 1 0 0 ) , 90 , 90 , F a l s e )

It is important that the points of a line and polygon object are always given in the same order, (from bottom left corner point clockwise till last corner point), else some calculations will be wrong.

These three categories were chosen because they make it easy to build upon the Python Shapely package for computational geometry (Shapely manual). This is convenient because this package already has some build-in functions that can be used to calculate spatial relations between objects. However using the classes from the Shapely library just as they are wouldn’t be enough to make the contrast operation between object attributes. That’s why each objects has a set of attributes that are shared between all objects of all classes. These serve as the features used to perform the contrast operation between objects. The attributes are:

1. Shape: geometric shape described by a string 2. Center : a tuple indicating the center of mass

of the object

3. Size: area of an object

4. Ratio: height of the object divided by width 5. Angle: angle between the object and the

x-axis in degrees

6. Filling : whether the object is filled in or not

3.2.2

Arrangements

A full analogy consists of four arrangements labeled A, B, C and D, where D is unknown. An arrangement is constructed as a Python list filled with objects. The order of objects in arrangements is arbitrary, so if an arrangement contains three objects it doesn’t matter if they’re given as [circle, line, dot] or [line, dot, circle], however arrangements do have a functional order to facilitate indexing which is necessary for structural mapping. The code in 3.1 is an example of how to define arrangements.

(14)

CHAPTER 3. RESEARCH

> > > A = [ o1 , o2 ] > > > p r i n t( A )

{ o1 :[ o1 . shape , o1 . center , o1 . size , o1 . ratio , o1 . angle , o1 . f i l l i n g ] o2 :[ o2 . shape , o2 . center , o2 . size , o2 . ratio , o2 . angle , o2 . f i l l i n g ] }

> > > p r i n t( A [ 0 ] )

[ o1 . shape , o1 . center , o1 . size , o1 . ratio , o1 . angle , o1 . f i l l i n g ]

Listing 3.1: Example of an arrangement

3.2.3

Operators

To be able to transform arrangements from one to another, operators that work on the objects are needed. These are the operators used in this research:

object index1, operator, parameter Description

i, moveHorizontal, distance change x-coordinate of the center with float distance

i, moveVertical, distance change y-coordinate of the center with float distance

i, scale, scale factor re-scale object with integer scale factor2

i, changeShape, "shape" change the shape of the object to "shape" while keeping all other attributes

i, rotate, θ rotate the object around its center point with angle θ

i, invertFill changes the current filling4 of the object to the inverse

i, delete deletes an object so it doesn’t map to the target arrangement

Table 3.1: Operators used to describe a transformation Note that:

1. The letter before the operator (indicated here with ’i ’) refers to the index of the position of the object within the arrangement list on which the operator is performed.

2. If the scale factor is negative the object is reduced, if the scale factor is positive the object is enlarged.

3. Objects are either filled in (black) or not (white).

3.2.4

Procedure

The procedure followed to solve visual analogies consists of several steps: 1. Annotate objects in the image to create arrangements

Test the annotation by exporting A as SVG 2. Compress A and B to find transformation T 3. Choose the best transformation

4. Structural mapping between A and C

5. Apply transformation T on arrangement C to decompress C to obtain arrangement D Export D as SVG, to see the result of the transformation

In the following each passage is described with more details. Each step is illustrated with the processing of analogy 3 (figure 3.2) that was also given at the beginning of this chapter.

(15)

CHAPTER 3. RESEARCH

Figure 3.2: Analogy 3 from Tomai et al. (2005) 1. Annotate objects in the image to create arrangements

Objects have been annotated to create arrangements following what is explained in section 3.2.1 and section 3.2.2.

o1 = P o l y g o n O b j e c t (’ t r i a n g l e ’, [(20.0 , 1 3 . 8 1 ) , (100 , 1 5 2 . 3 8 ) , (180.0 , 1 3 . 8 1 ) ] , F a l s e ) o2 = P o l y g o n O b j e c t (’ t r i a n g l e ’, [(60.0 , 3 6 . 9 1 ) , (100 , 1 0 6 . 1 9 ) , (140.0 , 3 6 . 9 1 ) ] , F a l s e ) A = [ o1 , o2 ]

Listing 3.2: Annotation of analogy 3A

o3 = P o l y g o n O b j e c t (’ t r i a n g l e ’, [(20.0 , 1 3 . 8 1 ) , (100 , 1 5 2 . 3 8 ) , (180.0 , 1 3 . 8 1 ) ] , F a l s e ) B = [ o3 ]

Listing 3.3: Annotation of analogy 3B

o1 = P o l y g o n O b j e c t (’ s q u a r e ’, [(62.5 , 1 3 7 . 5 ) , (137.5 , 1 3 7 . 5 ) , (137.5 , 6 2 . 5 ) , (62.5 , 6 2 . 5 ) ] , F a l s e )

o2 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 1 0 0 ) , 90 , 90 , 0 , F a l s e ) C = [ o1 , o2 ]

Listing 3.4: Annotation of analogy 3C Test the annotation by exporting A as SVG

Figure 3.3: Analogy 3 image A in SVG code 2. Compress A and B to find transformation T

The ultimate objective of the compressor is finding a shorter description of A and B. To do this a transformation must be found that describes B in terms of A plus applying some minimal transformation. The new description of A and B is then shorter than the original concatenated version of A and B (listing 3.5). > > > p r i n t( A , B ) A { o1 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 6 0 . 0 ) , s i z e = >11085.1 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] o2 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 6 0 . 0 ) , s i z e = >2771.3 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] } , B { o3 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 6 0 . 0 ) , s i z e = >11085.1 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] }

(16)

CHAPTER 3. RESEARCH

Arrangement B must be created from arrangement A via a transformation, that means that all objects in A should produce all objects in B. This means that only non-trivial solutions are considered. The transformation between A and B is found by contrasting the objects in A with the objects in B with as contrasting dimension their attributes (listing 3.6). However, since the compressor doesn’t know which objects in A map to which objects in B, when A and B are longer than one object, this ultimately means that there are more transformation possible between the arrangements (listing 3.7).

> > > p o s s i b l e _ m a p p i n g s = a l l _ m a p p i n g s ( A , B ) > > > p r i n t( p o s s i b l e _ m a p p i n g s )

[[(0 , N o n e ) , (1 , 0) ] , [(0 , 0) , (1 , N o n e ) ]]

# M a p p i n g s to N o n e are a s i g n of the o b j e c t b e i n g d e l e t e d . No c o n t r a s t b e t w e e n

# a t t r i b u t e s is n e e d e d in t h a t case , the c o m p r e s s o r i n f e r s t h a t the o p e r a t o r is ’ d e l e t e ’.

> > > o b j e c t _ c o n t r a s t ( A [1] , B [ 0 ] ) [0 , 0.0 , 0.0 , 2.0 , 0.0 , 0.0 , 0] > > > o b j e c t _ c o n t r a s t ( A [0] , B [ 0 ] ) [0 , 0.0 , 0.0 , 0 , 0.0 , 0.0 , 0]

Listing 3.6: Contrast between A and B

# I n s i d e g e t _ t r a n s f () , the m e t h o d s a l l _ m a p p i n g s () and o b j e c t _ c o n t r a s t () are c a l l e d

> > > p o s s i b l e _ T s = g e t _ t r a n s f ( A , B ) > > > for T in p o s s i b l e _ T s :

> > > p r i n t( T ) 0 , delete ,1 , scale , 2 . 0 1 , d e l e t e

Listing 3.7: Finding all possible transformations from A to B The compressed representation of A and B is then either

{ o1 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 6 0 . 0 ) , s i z e = >11085.1 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] o2 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 6 0 . 0 ) , s i z e = >2771.3 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] } + A [0] , delete , A [1] , scale , 2 . 0 or { o1 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 6 0 . 0 ) , s i z e = >11085.1 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] o2 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 6 0 . 0 ) , s i z e = >2771.3 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] } + A [1] , d e l e t e

3. Choose the best transformation

When there are more transformations possible from A to B, choose the best one, in other words the transformation with the lowest complexity. See section 3.3 for more details on how the complexity is computed. > > > for T in p o s s i b l e _ T s : > > > p r i n t(" T r a n s f o r m a t i o n : ", T , " C o m p l e x i t y : ", c o m p l e x i t y ( T ) ) T r a n s f o r m a t i o n : 0 , delete ,1 , scale , 2 . 0 C o m p l e x i t y : 17 T r a n s f o r m a t i o n : 1 , d e l e t e C o m p l e x i t y : 8 > > > b e s t _ T = min( c o m p l e x i t y ( p o s s i b l e _ T s ) ) > > > p r i n t( b e s t _ T ) 1 , d e l e t e

Listing 3.8: Choosing the best transformation

4. Structural mapping between A and C

Now that the transformation that best describes the analogy is found, arrangement C needs to be put in a order compatible with arrangement A, according to their structural mapping (listing 3.9).

> > > p r i n t( r e l a t i o n s ( A ) ) [(’ C o n t a i n s ’, 0 , 1) , (’ i s C o n t a i n e d ’, 1 , 0) ] > > > p r i n t( r e l a t i o n s ( C ) ) [(’ i s C o n t a i n e d ’, 0 , 1) , (’ C o n t a i n s ’, 1 , 0) ] C2 = s t r u c t _ m a p ( A , C ) # C = [ o1 , o2 ] , C2 = [ o2 , o1 ]

(17)

CHAPTER 3. RESEARCH

5. Apply transformation T on arrangement C to decompress C to obtain arrangement D The full compressed description of the analogy is now A, A+T, C2, C2+T. The decompression is allowing to apply the transformation on C2 and thereby creating D. The decompressor requires a list of objects and a sequence of operations with arguments and returns the decompressed version of D.

> > > D = a p p l y _ t r a n s ( C2 , T ) > > > p r i n t( D )

{ o1 :[ s h a p e = > circle , c e n t e r = >(100 , 1 0 0 ) , s i z e = > 2 5 4 0 6 . 0 4 2 7 7 3 4 2 2 0 1 7 , r a t i o = >1.0 , a n g l e = >0 , f i l l e d I n = > F a l s e ] }

Listing 3.10: Example decompressor Export D as SVG, to see the result of the transformation

Figure 3.4: Analogy 3 image D in SVG code

(18)

CHAPTER 3. RESEARCH

3.3

Complexity assignment

The complexity of a transformation is the length of its description in binary. To decide on this description, an encoding has been designed following Murena et al. (2017). The complexity of an operator or object is the length of its positional code in the instruction tree, see figure 3.6. The complexity of a parameter is the length of its digits. If the parameter is a float but the decimals are zero these are ignored. The decimal point, the actual point ’,’, is also ignored. If the parameter has more than 2 decimal points, everything after the first two decimals is ignored. A few examples. The complexity of ’5’ is 1, the complexity of ’-5.0’ is 2, the complexity ’0.5’ is 2, the complexity of ’-0.555’ is 4.

The complexity of an object is its positional code plus its index in the arrangement. This is done to reflect that when an arrangement has a lot of objects it becomes more complex to reason about. So for example, if an object is a triangle and it is the fourth object in an arrangement, than it’s positional code is:

code domain + code class + code class instance + index of object in arrangement = 0 + 00 + 0 + 01 = 0,00,0,01. It’s description length is thus 6 bits, which means that the object has a complexity of 6. The complexity of o1(LineObject), rotate, 45.0 is: len(0,1,0,0 + 1,11 + 45.0) = 9

The order of the objects and operators in the instruction tree is based on intuitive notions and is open for improvement.

Index 1 2 3 4 5 6 7 8 9 10 11 12

Code 0 1 00 01 10 11 000 001 010 011 100 101

Complexity 1 1 2 2 2 2 3 3 3 3 3 3

(19)

CHAPTER 3. RESEARCH -Operator (1) changeShape (1,000) rotate (1,11) scale (1,10) delete (1,01) invertFill (1,00) moveVertical (1,1) moveHorizontal (1,0) class (0) PolygonObject (0,00) ... pentagon (0,00,10) ... quadrilateral (0,00,01) ... rectangle (0,00,00) ... square (0,00,1) ... triangle (0,00,0) ... object 2 (0,00,0,1) object 1 (0,00,0,0) LineObject (0,1) ... multiline (4p) (0,1,01) ... multiline (3p) (0,1,00) ... curved line (arc) (0,1,1) ... simple line (2p) (0,1,0) ... object 2 (0,1,0,1) object 1 (0,1,0,0) RoundObject (0,0) ellipse (0,0,00) ... circle (0,0,1) ... dot (0,0,0) ... object 2 (0,0,0,1) object 1 (0,0,0,0)

(20)

Chapter 4

Results

Of the 20 analogy problems taken as input the compressor developed for this project was able to solve 5. This chapter shows how the results on these problems were generated. The results that didn’t work will be discussed in chapter 5.

4.1

Results analogy 2

Figure 4.1: Analogy 2 Annotation of the image

o1 = o1 = L i n e O b j e c t (’ l i n e ’, [ ( 1 0 0 , 2 0 ) , ( 1 0 0 , 1 8 0 ) ]) A = [ o1 ] o2 = L i n e O b j e c t (’ l i n e ’, [ ( 1 5 6 . 5 6 8 5 4 2 4 9 4 9 2 3 8 , 4 3 . 4 3 1 4 5 7 5 0 5 0 7 6 2 ) , ( 4 3 . 4 3 1 4 5 7 5 0 5 0 7 6 2 , 1 5 6 . 5 6 8 5 4 2 4 9 4 9 2 3 8 ) ]) B = [ o2 ] o1 = L i n e O b j e c t (’ m u l t i l i n e ’, [ ( 1 0 0 , 2 0 ) , ( 1 0 0 , 1 8 0 ) , (100 , 1 0 0 ) , ( 2 0 , 1 0 0 ) , ( 1 8 0 , 1 0 0 ) ]) C = [ o1 ] Compression of A and B > > > p o s s i b l e _ T s = g e t _ t r a n s f ( A , B ) > > > for T in p o s s i b l e _ T s : > > > p r i n t(" T r a n s f o r m a t i o n : ", T , " C o m p l e x i t y : ", c o m p l e x i t y ( T ) ) T r a n s f o r m a t i o n : 0 , rotate , -45 C o m p l e x i t y : 10

The only (non trivial) transformation from A to B is, found by the compressor: T = 0, rotate, −45

complexity = 10

Structural mapping between A and C

Both A and C have only one object so they automatically map to each other. Apply T on C to obtain D

> > > D = a p p l y _ t r a n s ( C , T ) > > > p r i n t( D )

(21)

CHAPTER 4. RESULTS

{ o1 :[ s h a p e = > line , c e n t e r = > ( 9 0 . 5 7 1 9 0 9 5 8 4 1 7 9 3 7 , 1 0 0 . 0 ) , s i z e = >480.0 , r a t i o = >1.0 , a n g l e = >90.0 , f i l l e d I n = > F a l s e ] }

Export D as SVG

Figure 4.2: Analogy 2 image D as produced by the compressor (screenshot of SVG)

4.2

Analogy 3

Figure 4.3: Analogy 3 Annotation of the image

o1 = P o l y g o n O b j e c t (’ t r i a n g l e ’, [(20.0 , 1 3 . 8 1 ) , (100 , 1 5 2 . 3 8 ) , (180.0 , 1 3 . 8 1 ) ] , F a l s e ) o2 = P o l y g o n O b j e c t (’ t r i a n g l e ’, [(60.0 , 3 6 . 9 1 ) , (100 , 1 0 6 . 1 9 ) , (140.0 , 3 6 . 9 1 ) ] , F a l s e ) A = [ o1 , o2 ] o3 = P o l y g o n O b j e c t (’ t r i a n g l e ’, [(20.0 , 1 3 . 8 1 ) , (100 , 1 5 2 . 3 8 ) , (180.0 , 1 3 . 8 1 ) ] , F a l s e ) B = [ o3 ] o1 = P o l y g o n O b j e c t (’ s q u a r e ’, [(62.5 , 1 3 7 . 5 ) , (137.5 , 1 3 7 . 5 ) , (137.5 , 6 2 . 5 ) , (62.5 , 6 2 . 5 ) ] , F a l s e ) o2 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 1 0 0 ) , 90 , 90 , 0 , F a l s e ) C = [ o1 , o2 ] Compression of A and B > > > for T in p o s s i b l e _ T s : > > > p r i n t(" T r a n s f o r m a t i o n : ", T , " C o m p l e x i t y : ", c o m p l e x i t y ( T ) ) T r a n s f o r m a t i o n : 0 , delete ,1 , scale , 2 . 0 C o m p l e x i t y : 17 T r a n s f o r m a t i o n : 1 , d e l e t e C o m p l e x i t y : 8 > > > b e s t _ T = min( c o m p l e x i t y ( p o s s i b l e _ T s ) ) > > > p r i n t( b e s t _ T ) 1 , d e l e t e

The best transformation from A to B according to the compressor is: T = 1, delete

complexity = 8

Structural mapping between A and C

> > > p r i n t( r e l a t i o n s ( A ) ) [(’ C o n t a i n s ’, 0 , 1) , (’ i s C o n t a i n e d ’, 1 , 0) ] > > > p r i n t( r e l a t i o n s ( C ) ) [(’ i s C o n t a i n e d ’, 0 , 1) , (’ C o n t a i n s ’, 1 , 0) ] C2 = s t r u c t _ m a p ( A , C ) # C = [ o1 , o2 ] , C2 = [ o2 , o1 ] Apply T on C to obtain D

(22)

CHAPTER 4. RESULTS > > > D = a p p l y _ t r a n s ( C2 , T ) > > > p r i n t( D ) { o1 :[ s h a p e = > circle , c e n t e r = >(100 , 1 0 0 ) , s i z e = > 2 5 4 0 6 . 0 4 2 7 7 3 4 2 2 0 1 7 , r a t i o = >1.0 , a n g l e = >0 , f i l l e d I n = > F a l s e ] } Export D as SVG

Figure 4.4: Analogy 3 image D as produced by the compressor (screenshot of SVG)

4.3

Analogy 4

Figure 4.5: Analogy 4 Annotation of the image

o1 = L i n e O b j e c t (’ l i n e ’, [ ( 1 3 0 . 0 , 1 0 0 . 0 ) , (30.0 , 1 0 0 . 0 ) ]) o2 = R o u n d O b j e c t (’ dot ’, (80 , 1 2 5 ) , 1 , 1 , 0 , F a l s e ) A = [ o1 , o2 ] o3 = L i n e O b j e c t (’ l i n e ’, [ ( 1 3 0 . 0 , 1 0 0 . 0 ) , (30.0 , 1 0 0 . 0 ) ]) o4 = R o u n d O b j e c t (’ dot ’, (180 , 1 2 5 ) , 1 , 1 , 0 , F a l s e ) B = [ o3 , o4 ] o1 = L i n e O b j e c t (’ m u l t i l i n e ’, [ ( 1 3 5 , 7 5 ) , (25 ,75) , ( 2 5 , 1 2 5 ) , ( 1 3 5 , 1 2 5 ) ]) o2 = R o u n d O b j e c t (’ dot ’, (80 , 1 0 0 ) , 1 , 1 , 0 , F a l s e ) C = [ o1 , o2 ] Compression of A and B > > > for T in p o s s i b l e _ T s : > > > p r i n t(" T r a n s f o r m a t i o n : ", T , " C o m p l e x i t y : ", c o m p l e x i t y ( T ) ) T r a n s f o r m a t i o n : 1 , m o v e H o r i z o n t a l , 1 0 0 C o m p l e x i t y : 9 T r a n s f o r m a t i o n : 0 , c h a n g e S h a p e , dot , m o v e H o r i z o n t a l ,100.0 , m o v e V e r t i c a l ,25.0 ,1 , c h a n g e S h a p e , line , m o v e V e r t i c a l , -25.0 C o m p l e x i t y : 36 > > > b e s t _ T = min( c o m p l e x i t y ( p o s s i b l e _ T s ) ) > > > p r i n t( b e s t _ T ) 1 , m o v e H o r i z o n t a l , 1 0 0

The best transformation from A to B according to the compressor is: T = 1, moveHorizontal, 100

complexity = 9

Structural mapping between A and C

> > > p r i n t( r e l a t i o n s ( A ) )

[(’ i s B e l o w ’, 0 , 1) , (’ i s A b o v e ’, 1 , 0) ] > > > p r i n t( r e l a t i o n s ( C ) )

[(’ i s L e f t O f ’, 0 , 1) , (’ i s R i g h t O f ’, 1 , 0) ] C2 = s t r u c t _ m a p ( A , C )

(23)

CHAPTER 4. RESULTS Apply T on C to obtain D > > > D = a p p l y _ t r a n s ( C2 , T ) > > > p r i n t( D ) { o1 :[ s h a p e = > m u l t i l i n e , c e n t e r = > ( 6 9 . 8 1 4 8 1 4 8 1 4 8 1 4 8 1 , 1 0 0 . 0 ) , s i z e = >270.0 , r a t i o = >1.0 , a n g l e = >30.0 , f i l l e d I n = > F a l s e ] o2 :[ s h a p e = > dot , c e n t e r = >(180.0 , 1 0 0 ) , s i z e = >1 , r a t i o = >1.0 , a n g l e = >0 , f i l l e d I n = > F a l s e ] } Export D as SVG

Figure 4.6: Analogy 4 image D as produced by the compressor (screenshot of SVG)

4.4

Analogy 5

Figure 4.7: Analogy 5 Annotation of the image

o1 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 1 4 0 ) , 20 , 20 , 0 , F a l s e ) o2 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 1 4 0 ) , 40 , 40 , 0 , F a l s e ) o3 = P o l y g o n O b j e c t (’ s q u a r e ’, [(80.0 , 3 5 . 0 ) , (120.0 , 3 5 . 0 ) , (120.0 , 7 5 . 0 ) , (80.0 , 7 5 . 0 ) ] , F a l s e ) A = [ o1 , o2 , o3 ] o4 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 1 4 0 ) , 20 , 20 , 0 , F a l s e ) o5 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 55) , 40 , 40 , 0 , F a l s e ) o6 = P o l y g o n O b j e c t (’ s q u a r e ’, [(80.0 , 3 5 . 0 ) , (120.0 , 3 5 . 0 ) , (120.0 , 7 5 . 0 ) , (80.0 , 7 5 . 0 ) ] , F a l s e ) B = [ o4 , o5 , o6 ] o1 = P o l y g o n O b j e c t (’ t r i a n g l e ’, [(40.0 , 9 8 . 2 4 5 7 3 5 1 9 4 5 7 ) , (100 , 1 9 0 ) , (160.0 , 9 8 . 2 4 5 7 3 5 1 9 4 5 7 ) ] , F a l s e ) o2 = P o l y g o n O b j e c t (’ s q u a r e ’, [(80.0 , 1 5 0 . 0 ) , (120.0 , 1 5 0 . 0 ) , (120.0 , 1 1 0 . 0 ) , (80.0 , 1 1 0 . 0 ) ] , F a l s e ) o3 = R o u n d O b j e c t (’ c i r c l e ’, (100 , 50) , 20 , 20 , 0 , F a l s e ) C = [ o1 , o2 , o3 ] Compression of A and B > > > for T in p o s s i b l e _ T s : > > > p r i n t(" T r a n s f o r m a t i o n : ", T , " C o m p l e x i t y : ", c o m p l e x i t y ( T ) ) T r a n s f o r m a t i o n : 1 , m o v e V e r t i c a l , -85 C o m p l e x i t y : 9 T r a n s f o r m a t i o n : 1 , c h a n g e S h a p e , square , m o v e V e r t i c a l , -85.0 ,2 , c h a n g e S h a p e , c i r c l e C o m p l e x i t y : 29 T r a n s f o r m a t i o n : 0 , m o v e V e r t i c a l , -85 , scale ,2.0 ,1 , scale , 0 . 5 C o m p l e x i t y : 23 T r a n s f o r m a t i o n : 0 , m o v e V e r t i c a l , -85 , scale ,2.0 ,1 , c h a n g e S h a p e , square , m o v e V e r t i c a l , -85.0 ,2 , c h a n g e S h a p e , circle , m o v e V e r t i c a l , 8 5 . 0 C o m p l e x i t y : 47 T r a n s f o r m a t i o n : 0 , c h a n g e S h a p e , square , m o v e V e r t i c a l , -85.0 ,1 , scale ,0.5 ,2 , c h a n g e S h a p e , c i r c l e C o m p l e x i t y : 39 T r a n s f o r m a t i o n : 0 , c h a n g e S h a p e , square , m o v e V e r t i c a l , -85.0 ,1 , m o v e V e r t i c a l , -85 ,2 , c h a n g e S h a p e , circle , m o v e V e r t i c a l , 8 5 . 0

(24)

CHAPTER 4. RESULTS

C o m p l e x i t y = 34

> > > b e s t _ T = min( c o m p l e x i t y ( p o s s i b l e _ T s ) ) > > > p r i n t( b e s t _ T )

1 , m o v e V e r t i c a l , -85

The best transformation from A to B according to the compressor is: T = 1, moveV ertical, −85

complexity = 9

Structural mapping between A and C

> > > p r i n t( r e l a t i o n s ( A ) ) [(’ i s C o n t a i n e d ’, 0 , 1) , (’ i s A b o v e ’, 0 , 2) , (’ C o n t a i n s ’, 1 , 0) , (’ i s A b o v e ’, 1 , 2) , (’ i s B e l o w ’, 2 , 0) , (’ i s B e l o w ’, 2 , 1) ] > > > p r i n t( r e l a t i o n s ( C ) ) [(’ C o n t a i n s ’, 0 , 1) , (’ i s A b o v e ’ 0 , 2) , (’ i s C o n t a i n e d ’, 1 , 0) , (’ i s A b o v e ’, 1 , 2) , ( isBelow , 2 , 0) , (’ i s B e l o w ’, 2 , 1) ] C2 = s t r u c t _ m a p ( A , C ) Apply T on C to obtain D > > > D = a p p l y _ t r a n s ( C2 , T ) > > > p r i n t( D ) { o1 :[ s h a p e = > square , c e n t e r = >(100.0 , 1 3 0 . 0 ) , s i z e = >1600.0 , r a t i o = >1.0 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] o2 :[ s h a p e = > t r i a n g l e , c e n t e r = >(100.0 , 4 3 . 8 ) , s i z e = >5505.3 , r a t i o = >0.9 , a n g l e = >0.0 , f i l l e d I n = > F a l s e ] o3 :[ s h a p e = > circle , c e n t e r = >(100 , 50) , s i z e = > 1 2 5 4 . 6 1 9 3 9 6 2 1 8 3 7 5 9 , r a t i o = >1.0 , a n g l e = >0 , f i l l e d I n = > F a l s e ] } Export D as SVG

Figure 4.8: Analogy 5 image D as produced by the compressor (screenshot of SVG)

4.5

Analogy 14

Figure 4.9: Analogy 14 Annotation of the image

o1 = P o l y g o n O b j e c t (’ s q u a r e ’, [(35 , 1 6 5 ) , (165 , 1 6 5 ) , (165 , 35) , (35 , 35) ] , F a l s e ) A = [ o1 ]

o2 = P o l y g o n O b j e c t (’ s q u a r e ’, [ ( 8 . 0 7 6 1 1 8 4 4 5 7 4 8 8 1 8 , 1 0 0 ) , (100 , 1 9 1 . 9 2 3 8 8 1 5 5 4 2 5 1 2 ) , ( 1 9 1 . 9 2 3 8 8 1 5 5 4 2 5 1 2 , 1 0 0 ) , (100 , 8 . 0 7 6 1 1 8 4 4 5 7 4 8 8 1 8 ) ] , F a l s e )

(25)

CHAPTER 4. RESULTS o1 = o3 = P o l y g o n O b j e c t (’ o c t a g o n ’, [(75 , 25) , (25 , 75) , (25 , 1 2 5 ) , (75 , 1 7 5 ) , (125 , 1 7 5 ) , (175 , 1 2 5 ) , (175 , 75) , (125 , 25) ] , F a l s e ) C = [ o1 ] Compression of A and B > > > for T in p o s s i b l e _ T s : > > > p r i n t(" T r a n s f o r m a t i o n : ", T , " C o m p l e x i t y : ", c o m p l e x i t y ( T ) ) T r a n s f o r m a t i o n : 0 , rotate ,45 C o m p l e x i t y : 12 > > > b e s t _ T = min( c o m p l e x i t y ( p o s s i b l e _ T s ) ) > > > p r i n t( b e s t _ T ) 0 , rotate ,45

The only (non trivial) transformation from A to B is, found by the compressor: T = 0, rotate, 45

complexity = 12

Structural mapping between A and C Both A and C have only one object so they automatically map to each other.

Apply T on C to obtain D > > > D = a p p l y _ t r a n s ( C2 , T ) > > > p r i n t( D ) { o1 :[ s h a p e = > octagon , c e n t e r = >(100.0 , 1 0 0 . 0 ) , s i z e = >17500.0 , r a t i o = >1.4 , a n g l e = >135.0 , f i l l e d I n = > F a l s e ] } Export D as SVG

(26)

Chapter 5

Evaluation and discussion

The results have shown that the proposed method was successful in solving 5 out of the 20 geometric anal-ogy problems used for the study, namely analanal-ogy 2, 3, 4, 5 and 14. Additionally, the solutions constructed by the compressor match the solutions chosen by most human participants. Given the assumption that the best solution is the least complex one and the knowledge that humans implicitly apply Occam’s razor, these solutions are also considered the best possible solutions to the input problems. That means that in each of these 5 analogies the compressor has shown that the best solution to the analogy is indeed the least complex one. The order of difficulty of these analogies for humans, according to their reaction time, was 5 - 14 - 4 - 2 - 3. The order of complexity from high to low according to the compressor is 14 - 2 - 4/5 - 3. This means that at this point the complexity of a solution doesn’t give a good corre-spondence with the reaction times by humans. An explanation of why this could be is given in section 5.3. In the following section the analogies that the compressor wasn’t able to solve will be discussed along with the reasons why. In addition, possible extensions on the compressor will be given in order to make it possible to solve these problems as well. Although only a small part of the analogies have been solved, the overall approach seems to be successful, because the remaining analogies were not solved mostly due to missing operators and missing implementation functionality resulting in wrong object mappings. The compressor designed for this research can therefore be seen as a prototype, extensions on this version of the compressor should be quite easy to make.

5.1

Limitations of the compressor

All errors are due to one of 3 causes: (a) unable to identify the correct transformation, (b) unable to identify the correct mapping, (c) There lacks something in the implementation of the object. In the following we will analyse the problems for each analogy.

Cause of error Analogy

(a) unable to identify the correct transfor-mation

analogy 6, 9, 10, 12, 16, 18, 19, 20 (b) unable to identify the correct mapping analogy 1, 7, 8, 11, 15, 20

(c) There lacks something in the imple-mentation of the object

analogy 1, 6, 7, 8, 11, 13, 18

(27)

CHAPTER 5. EVALUATION AND DISCUSSION

Analogy 1

Figure 5.1: Analogy 1

Problem: The fan shaped object in C cannot be implemented by one class instance. To

make the shape, two objects need to be used. However this troubles the finding of a right

mapping between A and C.

Suggestions: Redesign or introduce a new object class so that objects can have straight

and curved edges.

Analogy 6

Figure 5.2: Analogy 6

Problem: There is no method to assign ’rotation’ to arcs, resulting in the compressor

finding no transformation between A and B.

Solution: Design a method to assign ’rotation’ to arcs.

Analogy 7

Figure 5.3: Analogy 7

Problem: Same problem as in analogy 1. The half-circle shaped object cannot be

imple-mented because no object can have straight and curved lines. To make the shape, two

(28)

CHAPTER 5. EVALUATION AND DISCUSSION

objects need to be used. However this troubles the finding of a right mapping between A

and C.

Solution: Same solution as with analogy 1. Redesign or introduce a new object class so

that objects can have straight and curved edges.

Analogy 8

Figure 5.4: Analogy 8

Problem: Same problem as in analogy 1 and 7.

Solution: Same solution as in analogy 1 and 7.

Analogy 9

Figure 5.5: Analogy 9

Problem: Unable to identify the transformation "add object".

Suggestion: Add an additional operator.

Analogy 10

Figure 5.6: Analogy 10

Problem: Unable to identify the transformation "switch position".

Solution: Add an additional operator.

(29)

CHAPTER 5. EVALUATION AND DISCUSSION

Analogy 11

Figure 5.7: Analogy 11

Problem: Same problem as in analogy 1, 7 and 8.

Solution: Same solution as in analogy 1, 7 and 8.

Analogy 12

Figure 5.8: Analogy 12

Problem: Unable to identify transformation "reflect". B and P shape cannot be

imple-mented using 1 object.

Solution: Add an additional operator. Redesign or introduce a new object class so that

objects can have straight and curved edges.

Analogy 13

Figure 5.9: Analogy 13

Problem: Unable to perform the rotation on the T-shape.

Solution: Improve the application of the rotation operation.

(30)

CHAPTER 5. EVALUATION AND DISCUSSION

Analogy 15

Figure 5.10: Analogy 15

Problem: Unable to identify the correct mapping.

Solution: Add a structural relation that captures the ’isNextTo’ relation.

Analogy 16

Figure 5.11: Analogy 16

Problem: Unable to identify the transformation "add object".

Solution: Add an additional operator.

Analogy 17

Figure 5.12: Analogy 17

Problem: The best solution according to the compressor wasn’t amongst the possible

solutions.

(31)

CHAPTER 5. EVALUATION AND DISCUSSION

Analogy 18

Figure 5.13: Analogy 18

Problem: Unable to identify the transformation "reflect". B shape cannot be implemented

using 1 object.

Solution: Add additional operator. Redesign or introduce a new object class so that

objects can have straight and curved edges.

Analogy 19

Figure 5.14: Analogy 19

Problem: Unable to identify the transformation "reflect".

Solution: Add additional operator.

Analogy 20

Figure 5.15: Analogy 20

Problem: Unable to identify the correct mapping.

Unable to identify the operation

"switch position".

Solution: Add a structural relation that captures the ’isNextTo’ relation. Add additional

operator.

(32)

CHAPTER 5. EVALUATION AND DISCUSSION

5.2

Comparison with solution by Lovett et al.

Much work has been done by Lovett, Forbus, Tomai and Usher ((Tomai et al., 2005),

(Lovett et al., 2009) and (Lovett and Forbus, 2012)) in modelling geometric analogy

problems. As mentioned in sec. 3, their work tries to solve the same exercises as the

present work but with a slightly different approach. One of the differences is that their

model depends heavenly on the visual input, in particular on sketch understanding. To

threat the visual objects they use a tool called CogSketch (Forbus et al., 2011) that

com-putes the visual structure of an image. This research on the other hand largely bypasses

the interpretation of visual input and tries to abstract away from the particular visual

ob-jects. To perform the shape matching, their model requires topological information which

means that the implementation requires a logical model of the input, extracted from the

visual input. This model does not necessarily need that. Because the contrast between

objects is used, a relative distance between objects can be described that is independent

of topological information. This makes the proposed model more fine-grained as it can

capture also an ‘intensity’ of transformation.

As can be concluded from section 5.1, the compressor had a lot of trouble with correctly

recognizing rotated or reflected objects that went beyond the most general instances of a

class

1

. This is something that the model used by Lovett et al. was better at. Inspiration

from their implementation could be drawn to improve this.

5.3

Other remarks

One of the frequently mentioned possibilities to improve the compressor is to add more

operators to account for the unidentified transformations. On the other hand, the

ques-tion should be asked whether it is not better to identify a basic set of operaques-tions from

which more complicated operators can be constructed. This keeps figure 3.6 from growing

infinite branches and keeps the model simple. Multiple sets can be tried to find a set that

is complete enough to identify all transformations and basic to keep the set small. This

could also be an automated process.

Another improvement that is mentioned a lot is the implementation of an additional

class that deals with objects that have round and straight edges. This is necessary

be-cause humans see connected lines as being one object, so modeling these kinds of shapes

as separate objects unjustly makes the modeling more complicated. Another way to deal

with this problem is to include a method to create composed objects, so essentially like

adding another layer to the model: arrangements - objects - parts of objects.

One important aspect of human problem solving is not captured by this model, and

that is that humans get better at solving a problem with practice. This is not reflected

in the complexity of an analogy, and the question of how to incorporate this in the model

remains open.

In the current model, a complexity is only assigned to the transformation of an

anal-ogy. However it would be even better if the compressor language was extended to be able

to describe the full analogy A:B :: C:D. In this way the full complexity of the analogy

can be made explicit, and the human reaction times are better reflected. An example

of how this could look like for analogy 2 is shown below. The operator ’stack’ pushes

an item to short term memory, the operator ’mem’ retrieves the item from memory and

(33)

CHAPTER 5. EVALUATION AND DISCUSSION

’writes it down’ or ’draws it on’. The operator ’next_block’ moves to the next block, or

next image, in the analogy (so for example, moving from A to B). Positional code for the

additional operators:

’stack’ = 0,0, ’mem’ = 0,1, ’next_block’ = 0,00

Analogy 2:

Full description of the analogy without compression:

stack, o1, stack, o2, stack, o3

mem, 0, mem, 1, next_block, mem, 2

Full complexity of this description is 53.

Description of the analogy with compression, so B is constructed from the elements of A:

stack, o1, stack, o2

mem, 0, mem, 1, next_block, mem, 0

Full complexity of this description is 30.

Lastly, an effort could be made to design a better order of operators and objects in the

instruction tree.

(34)

Chapter 6

Conclusion

This research was an investigation at modeling a different approach to solving

geomet-ric analogy problems. It explores a possibility to perform structural analogy following

an alternative method from most works about this topic (Tomai 2005, Lovett 2009,

Lovet&Forbus 2012). The approach taken here was to see the solution to an analogy

problem as a complexity minimization problem. To do this a compressor was designed

to find a transformation between objects by exploring their internal organisation using

implementations of functions corresponding to structural mapping and to contrast.

The compressor was able to solve only 5 out of the 20 analogy problems of the input

set. However, an analysis of the incorrectly solved problems has shown that problems were

due to the rigidness of the compressor at this stage of the implementation, and several,

in principle simple, extensions have been proposed to complete and extend the current

version.

It remains however to be understood whether a limited set of manually encoded

oper-ators is sufficient to cover all possible visual objects. Investigating how operoper-ators can be

extracted automatically and how this method can be interfaced with modules processing

the original visual input remains an open research question.

(35)

Bibliography

J.-L. Dessalles. From conceptual spaces to predicates. In Applications of Conceptual

Spaces, pages 17–31. Springer, 2015.

T. G. Evans. A program for the solution of geometric-analogy intelligence-test questions.

1968.

K. Forbus, J. Usher, A. Lovett, K. Lockwood, and J. Wetzel. Cogsketch: Sketch

under-standing for cognitive science research and for education. Topics in Cognitive Science,

3(4):648–666, 2011.

D. Gentner. Structure-mapping: A theoretical framework for analogy. Cognitive science,

7(2):155–170, 1983.

L. S. Gottfredson. Mainstream science on intelligence: An editorial with 52 signatories,

history, and bibliography, 1997.

D. R. Hofstadter and M. Mitchell. The copycat project: A model of mental fluidity and

analogy-making. 1994.

S. Legg and M. Hutter. Universal intelligence: A definition of machine intelligence. Minds

and machines, 17(4):391–444, 2007.

M. Li, X. Chen, X. Li, B. Ma, and P. M. Vitányi. The similarity metric. IEEE transactions

on Information Theory, 50(12):3250–3264, 2004.

M. Li, P. Vitányi, et al. An introduction to Kolmogorov complexity and its applications,

volume 3. Springer, 2008.

A. Lovett and K. Forbus. Modeling multiple strategies for solving geometric analogy

prob-lems. In Proceedings of the Annual Meeting of the Cognitive Science Society, volume 34,

2012.

A. Lovett, E. Tomai, K. Forbus, and J. Usher.

Solving geometric analogy problems

through two-stage analogical mapping. Cognitive science, 33(7):1192–1231, 2009.

A. Lovett, K. Forbus, and J. Usher. A structure-mapping model of raven’s progressive

ma-trices. In Proceedings of the Annual Meeting of the Cognitive Science Society, volume 32,

2010.

P.-A. Murena, J.-L. Dessalles, and A. Cornuéjols. A complexity based approach for solving

hofstadter’s analogies. In ICCBR (Workshops), pages 53–62, 2017.

J. Raven. The raven’s progressive matrices: change and stability over culture and time.

Cognitive psychology, 41(1):1–48, 2000.

L. M. Terman and M. A. Merrill. Stanford-binet intelligence scale: Manual for the third

revision, form lm. 1960.

(36)

BIBLIOGRAPHY

E. Tomai, A. Lovett, K. D. Forbus, and J. Usher. A structure mapping model for solving

geometric analogy problems. 2005.

I. B. A. TURING. Computing machinery and intelligence-am turing. Mind, 59(236):433,

1950.

(37)
(38)

Appendix A

Raven’s Progressive Matrices

What replaces the question mark?

Referenties

GERELATEERDE DOCUMENTEN

This program seems quite interesting, and it would complement work by other authors on gradient flows in Wasserstein spaces over infinite dimensional spaces (see [7], and [6]

Two types of meta- models are used to provide the semantics of the models: an architectural meta-model to model the software architecture and a Communicating Sequential Processes

In conclusion, this thesis presented an interdisciplinary insight on the representation of women in politics through media. As already stated in the Introduction, this work

DEFINITIEF | Farmacotherapeutisch rapport safinamide (Xadago®) als adjuvante behandeling naast levodopa alleen of in combinatie met andere antiparkinsonmiddelen bij patiënten

The aim of this pilot study was to objectively assess whether the AWESD is able to improve Veress needle entry safety by increasing the distance towards the intestines, AA, and VC,

While existing notions of prior knowledge focus on existing knowledge of individual learners brought to a new learning context; research on knowledge creation/knowledge building

Full rotation in spot of the end-effector: (a) Desired orientation expressed in Euler angles; (b) end-effector position tracking error; (c) end-effector orientation tracking error;

The objectives of the British Institute at Ankara are to enable UK scholars across the humanities and social sciences to undertake world-class original research and fieldwork focused