简体   繁体   中英

How can I predict a user generated distribution by learning from previous distributions

I am trying to program a prediction algorithmus which predicts the distribution of marbles among 4 cups based on the prevision user input. But I have no idea where to start or which techniques can be used to solve this.

Example:

There are 4 cups numbered from 0 to 3 and the user will receive x marbles which he distributes among those cups. Each round the user receives another amount of marbles (or the same amount) and before the user distributes them, the algorithm tries to predict the distribution based on the users previous inputs. After that the user “corrects” it. The goal is that the user does not have to correct anything hence the algorithm predicts the correct distribution. However the pattern which the user distributes the marbles can change, and the algorithm has to adapt.

This is the simplest design of the problem which already is not trivial to solve. However it get exponential more complex when the marbles have additional properties which can be used for distribution. For example, they could have a color and a weight.

So, for example, how does the algorithm learn that the user (most of the time) put the marbles with the same color in one cup, but cup 2 is (most of the time empty) and the rest is equally distributed?

So in my head the algorithm has to do something like this:

  • search for a pattern after the users distribution is done. Those patterns can be the amount of marbles per cup / weight per cup or anything else.
  • if a pattern is found a predefined value (weight) is added to the pattern
  • if a previous pattern was not found a predefined value has to be subtracted from the pattern
  • when the algorithm has to predict, all patterns with a predefined weight have to be applied.

I am not sure if I am missing something and how I would implement something like this or in which area I have to look for answers.

First of all, bear in mind that human behavior does not always follow a pattern. If the user distributes these marbles randomly, it will be hard to predict the next move!

But if there IS a pattern in the distributions, you might create a prediction using an algorithm such as a neural network or a decision tree.

For example:

// dataset1
// the weights and colors of 10 marbles
let dataset1 = [4,3,1,1,2,3,4,5,3,4,7,6,4,4,2,4,1,6,1,2]

// cups1
// the cups distribution of the above marbles
let labels1 = [2,1,0,2,1,1,3,1,0,1]

Now you can train an algorithm, for example a neural network or a decision tree. This isn't real code, just an example of how it could work.

let net = new NeuralNet()
net.train(dataset1, labels1)

After training with lots of data (at least hundreds of these datasets), you can give the network a new dataset and it will give you a prediction of the cups distribution

let newMarbleSet = [...]
let prediction = net.predict(newMarbleSet)

It's up to you what you want to do with this prediction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM