| emre şahin |
|
Research »
MainResearch Reports29 April 2008Mapping of GestaltsOnce gestalts of a particular situation are found, the problem of mapping these into each other emerges. Suppose situations A, B and C are as follows:
P1 P1 P1P1P1
C1 C1 C1 C1C1C1C1
D1 D1 D1D1D1 The problem is to find a situation D that satisfies A:B::C:D in an analogy problem. In other words, if there is an analogy relation between A and B, the same relation must hold between C and D too. Gestalt finding algorithm finds the following gestalts in these situations
A1 = and A2 =
B1 =
and B2 =
C1 = and C2 = Now, a mapping between these gestalts is necessary in order to find D. This mapping should match elements of A with elements of B and C and find a plausible answer for D. For such a matching, there might be several strategies:
We can add 1-1 criteria for these strategies as this is orthogonal to selection. However, there may not be equal number of gestalts in each situation so a 1-1 mapping may not be possible. This will be discussed in detail later. Along with matching strategies, similarity metric may also be variable. Following are possible:
Suppose gestalts of situations A and B have similarities (calculated by "matching all" strategy) like this:
A total maximization strategy will select the bold items below.
However, as this instance illustrates, this matching strategy has duplicate matching for A3 and no matching for A4. If a 1-1 constraint is imposed for "maximize total" strategy, following results are taken.
However, in this case A4 and B3 are matched against their similarity is very low. Also, 1-1 constraint leads to problems if the number of gestalts in each side is not equal. Suppose instead of the above, situation B has only 3 gestalts.
In this case, A4's matching should be arbitrary. 21 March 2008Gestalt Tiling AlgorithmGestalt tiling is a process to define a gestalt with a minimal Object pattern, which means the Gestalt uses Ex and Ey constructs rather than writing whole gestals as a single element. Example: A gestalt of the form P1P1P1 can be represented in two ways: Obj "P1P1P1" Mx 0 My 0 and Obj "P1" Mx 0 My 0 Ex 2 For better comparisons and pattern finding, we need the second form. Moreover, the number of candidates raise as the complexity in situation increases. In order to achieve this succint form for a given string, I model a "tiling algorithm" which tries to write a gestalt form as succintly as possible. Note that, since a gestalt may span more than one line, tiles may also be multilined. Example: P1P1P1 P2P2P2 should be represented like Obj "P1\nP2" Mx 0 My 0 Ex 2 I begin with a single line version and use this to solve the multiline version. tiledLine function takes a string in the form P1P1P1 and returns a list of patterns which fill this string. It can be used on any string. The resulting list, at least contains the input string, since any string can be composed by itself. > tiledLine :: Eq a => [a] -> [[Research/a]] > tiledLine inStr = let --inStr = "P1P1P1" > len = length inStr --len = 6 > strGroups = flip makeGroup inStr --strGroups 2 = ["P1", "P1", "P1"] > allGroups = [strGroups ln | ln <- [1..(len-1)]] > --allGroups = [["P", "1", "P", "1"...], ["P1", "P1", "P1"], ...] > equalGroups = map (\x -> head x) $ filter (\(h:t) -> all (h ==) t) allGroups > in > equalGroups ++ [inStr] > For a situation to be composed of tiles, its lines should be composed of tiles that have the same length. Hence, the program should first find tiles of each line and find a minimum length where all tiles of each line meet. For example: P1P2P1P2 C1C1C1C1 is sent to tiledLine and two lists of ["P1P2", "P1P2P1P2"] and ["C1", "C1C1", "C1C1C1C1"] are retrieved. From these, since the minimum common length is 2 in these lists, the pattern of P1P2 C1C1 is selected as the tile. When a vertical pattern is found, a check to reduce also this is applied to it. Hence a pattern of the form P1P2 C1C2 P1P2 C1C2 is reduced to P1P2 C1C2 by checking also the vertical tiles. > tiledSituation :: String -> String > tiledSituation inSit = let > lineTiles = map tiledLine $ lines inSit :: [[Research/String]] > -- [["P1P1", "P1P1P1P1"], ...] > lenlst = map (map length) lineTiles :: [[Research/Int]] > -- [[4, 8], [4, 6, 8]...] > findCommons :: Ord a => [a] -> [a] -> [a] > findCommons [] _ = [] > findCommons _ [] = [] > findCommons (h1:t1) (h2:t2) > | h1 == h2 = h1:(findCommons t1 t2) > | h1 > h2 = findCommons (h1:t1) t2 > | otherwise = findCommons t1 (h2:t2) > > commonLength = foldr1 findCommons lenlst > minlen = minimum commonLength :: Int > res = map (\lst -> filter (\el -> length el == minlen) lst) lineTiles > singleLine = (concat . concat) res > pattern = makeGroup minlen $ head $ tiledLine singleLine > in > unlines pattern > 12 March 2008Gestalt RecognitionThe show / read debugging of Gestalt.lhs completed. Along the way I have modified showGestalt :: [Gestalt] -> String and readGestalt :: String -> [Gestalt] because:
Before this change, a situation of the form C1C1C1 C1____ could be written by Obj "C1" `Mx` 0 `My` 0 `Ex` 3 `Pin` Obj "C1" `Mx` 0 `My` 0 `Ey` 2 but this led to a recursion in description which is hard to control the limits. Instead, in the current version Obj "C1C1C1\nC1____" `Mx` 0 `My` 0 is preferred to above. In initial reading, however, elements should be separate, and there is no way to achieve this in current notation.
P1__P1__P1__P1__
Obj sit `Mx` 0 `My` 0 hence making each pattern in The problem of mapping can be represented in both bottom-up (current) and top-down methods. In bottom-up method, a list of the most basic elements are retrieved and united if a similarity occurs. In top-down approach, "strikingly different" patterns in the situation are found and divided from current one. A hybrid approach may yield better results but since modelling even one of "bottom-up" and "top-down" methods seems diffucult, a hybrid approach should wait.
A Mapping LanguageI started to think the overall methodology to solve the mapping problem. My initial idea is to represent the situation and hypothesize about them in a Genetic Programming fashion. In GP, a program (parse tree) on a problem is built and evaluated. A small language that defines gestalts and mappings can be built. This language, supposedly a Monad in Haskell, can be used to evaluate the success of mapping. An example might be something like: A = P1P1____ ________ B = ________ __C1C1__ C = C1C1______ __________ D = ? represented and solved as do
Obj "P1P1" `Mx` 0 `My` 0 OfSituation` "A" `Maps` Obj "C1C1" `Mx` 1 `My` 1 OfSituation` "B"
Obj "P1P1" `Mx` 0 `My` 0 OfSituation` "A" `Maps` Obj "C1C1" `Mx` 0 `My` 0 OfSituation` "C"
BuildSituation Obj "P1P1" `Mx` 1 `My` 1 OfSituation` "D"
and modifications can be done to this "program" to increase its utility. 5 February 2008Gestalt Recognition AlgorithmIn today's study session, I've thought about converting I'll need the following operator definitions beforehand. infixl `Mx` 7 infixl `My` 7 infixl `Ex` 7 infixl `Ey` 7 infix `Pin` 6 First of all, a redefinition of the data structure. This is basically the same with the structure I've recently told. I need a utility function that groups elements of a list by predefined numbers. Maybe there is something like this in the libraries but I didn't want to look it up, writing is more interesting. Next is to change a line like And finally a function to change a situation described by a string to a list of Gestalts. In the next session, I expect to combine these into a recognition algorithm. Hofstadter' Epilogue to the Analogical MindI read a few pages from Hofstadter's chapter in the book. His writing flow is not easy to follow. Content is wide and large, but instead of a true picture, he gives anecdotes here and there which makes the entire writing even more ahrd to grasp.
I'm continuing to read. Online PapersLinks |
Türkçe English |
| Page last modified on November 17, 2007, at 12:25 AM EST - Powered by PmWiki |