Skip to main content
GameDev.net gamedev.net
🔒 Locked

Neural Net for pattern recognition

Started by darkm00n Aug 9, 2004 at 5:50 PM 8 replies 1.4k views
Original Post
darkm00n
darkm00n
Hey all, I'm doing a university project which involves doing neural network pattern recognition. The basic project is doing a simple implementation for Cluedo (no house, justpeople sitting around a table and asking questions) in a text-based format. I know it probably doesn't need a neural net, heuristics should work fine, but I'd like to give it a go with a neural net. I was thinking of designing one which was trained as you played the game (for eahc of the other computer players), and the outputs would be potentialally right combinations of cards. I was wondering if anyone could get me started on what sort of neaurl net to work (feedback, back propgation, FAm, SOMs) etc. Thank you very much : )
"Cause I''m a creep.. I''m a wierdo.."- Radiohead
Timkin
Timkin
Why don't you define the problem more clearly before trying to determine the tool to apply to it. You've mentioned you have a group of players sitting around a table asking questions. What sort of questions? Do you simply mean questions like, 'Was it Professor Plum, in the study with the candlestick'?

If so, how do you plan on encoding this information? What patterns are you hoping/expecting to find? Remember that 'pattern recognition' is just a fancy name for classification (also called clutering, data mining, mixture modelling, etc...). If you believe there is a natural classification of the data to a (typically) smaller set of classes/clusters/patterns then by all means apply an artificial neural network.

Without more information about the problem encoding and what you are trying to achieve, it is difficult to determine the appropriate tool for the job.

Cheers,

Timkin
darkm00n
darkm00n
Thanks for the reply, Timkin.

I was just asking for a place to get started but if you want specifics, alrighty then.

I thought about it like this:
The card information will be coded in 2 tuples - so 0, 4 might stand for Person, Professor Plum - these are just ints.

So you specify the players - from 2 to 5 and choose a character for you to be yourself. Then the cards are randomly dealt out until they're all dealt.

So then the computer players mark these cards off in a series of 3 arrays - one for people, weapons and places. I also have a counter for each of these arrays, so that when the counters are all at 1 below max, you know you have the answer. These arrays are bools.

I thought about the problem and about what information a computer/human player gets from the normal game. When a question is being asked by someone and of someone who is not the current player (human or comp.) They ask if the player has these 3 cards - a suggestion (e.g. 'Was it prof plum, with the candelstick, in the library'). If the person shows them a card, from this information we gather that they have one of those cards. if they DON'T show them a card, then we also get some information i.e. that they have none of those cards.

I'm doing a heuristic version first, so I am going to create 2 arrays, a hit and a miss array - in them i will put the three clues asked for, and who was asked. If they say yes, put it in the hit array, if no, put it in the miss. Then scan for patterns in these arrays (e.g. if a person is asked about a clue multiple times in different 3 tuples (i.e. prof plum over and over)) and it's always a hit, then ask that person about this card/clue with known clues for the other cards (if possible) - in this way you can dtermine exactly whether they have he card or not).

That's heuristically - for the neural net I was thinking of having, as inputs the last 3 cards asked, and then whether it was a hit or miss, and also the player. But I don't know how to organise this neural net etc. It would be trained as the game went on. I was vaguely thinking of having 4 layers, one for weapon, person, place, player and adjusting the weights between them accordingly.

But in answer to your question about encoding - it'd be encoded as a series of ints - 0 - 5 for people, 0 - 5 for weapons, 0 -8 for places, 0 - (max_player - 1) for players. They would be stored in arrays or STL vectors, either way would be fine.

But can you see whereh I think pattern recognition applies? The neural net would be getting information from the questions other people ask and the questions that the computer player, the net belongs to, asks, and adding all this into a net it would try and ascertain patterns - like in a logic puzzle, where you have just enough clues to solve the puzzle.
"Cause I''m a creep.. I''m a wierdo.."- Radiohead
Timkin
Timkin
Sorry for the delay in reply... work has been really hectic this week and my home box is in a state of flux (meaning I'm upgrading and rebuilding it).

Personally, I wouldn't use an ANN for this problem, but rather a Bayesian Network... I need to think about it more, but I'm struggling to see where the natural classification of the data comes in... essentially the distribution of cards to players is random... and the questions that can be asked are drawn from a fixed set. It's simply that you want to maximise the posterior probability over the distribution of cards to a given player GIVEN the question you ask. If you evaluate this for each possible question you can find the question that will maximise the information content of the answer, which reasonably brings you closer to knowing the truth (actually you really need to maximise this information content over all possible sequences of actions... but this is a tougher problem). This, in my mind, is a Value Of Information problem, rather than a classification problem. Let me think about it some more though... I'll hopefully get back to you later this week.

Cheers,

Timkin
Stoffel
Stoffel
Seems to me there are two problems here:
- how to ask a good question
- when to make a good guess

Making a correct guess is a simple matter of logic--there's no gray area here, unless you want to risk guessing before the solution has been determined (and risk losing, if I remember the rules). I don't know enough about neural nets to figure out which of these problems, if any, would be a good domain.

BTW, I also posted just to brag that I once won a 3-player game on the very first guess.
IADaveMark
IADaveMark
I would have to agree that ANNs wouldn't be primo in this situation. We are not looking for a pattern, we are looking for a discrete solution. In a way, this is similar to the game Mastermind in that you have to choose test patterns to close in on the hidden solution. Each guess only gives you partial information (if any). You can start out with a random guess and then use that information to prune down your possible solutions from there. This is something that can be completely algorithmic - possibly Bayesian as Timkin said.

If you want to do something with NNs, try doing something with image recognition. For example, the US Post Office uses NNs to identify the numbers in Zip Codes. ("Is this a 9 or a 7?") It subdivides the character area into pixels and analyzes the on/off status of each pixel. Each pixel is an input. As they are added and taken away, it pushes the solution toward or away from a particular solution number.

If you wanted to do this in a fun way, you could define a set of pictures (smilies, etc.) and have the user "draw" one of them and see if the NN can determine which one he is drawing. The length part of this, however, is training the NN to determine exactly where the crossover is between, for example, a smile and some other circle-like object (a light bulb?). Since there are so many inputs, you would have to run many itterations through it.

Anyway, back to the original thought... NNs just don't seem to be able to work here.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
darkm00n
darkm00n
Hey again,

Thank you all very much for your responses. Yes, I thought it might be hard to implement in a neural network form, but it's the topic i've been given so I guess I'll have to try. I'll investigate bayesian networks again, though, because my lecturer seems to classify them in the same group as neural nets : )

I also wanted to introduce fuzzy logic later on to make each player seem to have it's own personality - different Fuzzy Logic Manifolds for each player. Is that possible with Bayesian Networks?

Thanks again :)
"Cause I''m a creep.. I''m a wierdo.."- Radiohead
darkm00n
darkm00n
Hey, thanks again TimKin.

I COULD change the task, but I've already developed a heuristic way of doing it and was going to contrast an AI method with the heuristic one. Changing to Bayesian Networks would be fine,
because my ANN wokr hasn't progressed too far.

The lecturer in question is a games technology lecturer, not one who purely teaches AI based theory, so I'm not surprised he doesn't know thw minute differences. He's not much help, to be honest :)

Do you know of any good bayesian network resources? I've searched google and they're few and far between - well, ones with working links.

Thanks again
"Cause I''m a creep.. I''m a wierdo.."- Radiohead
Timkin
Timkin
There's plenty of free software out there for implementing Bayesian Networks. Kevin Murphy kept a good list on his pages at UC Berkely (CS department). I think the pages are stil there, even though he's not... check them out. He also has some tutorial information that might help (although it's related to his Matlab Bayes Net toolbox, so it might be a bit application specific).

In terms of books, I can recommend Bayesian Artificial Intelligence (Kevin Korb & Ann Nicholson) as being VERY comprehensive. It provides plenty of theory plus worked examples (but doesn't go into coding, since it's a text book). Other authors of note in the field are Finn Jensen, Rich Neapoliton, Judea Pearl (although his book, which came out just before Rich's first, is VERY heavy going, even for someone with a strong maths/stats background), Stuart Russell, Tom Dean and Michael Jordon (no, not THAT MJ)!

If you need further help or advice, just holler. If I don't know the answer, I have a direct line to the experts that do!

Cheers,

Timkin

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.