2
$\begingroup$

So, i need to use an MLP to predict a 12x12 matrix composed of floating points. The matrices are as this one that follows: enter image description here Most matrices have this "pattern".

As input, i have 7 floating points, such as these:

"2.0", "0.23", "239.10","3.5", "12,0", "10.6", "0.62".

To simplify the output matrix, i've converted it in a array with the 144 elements of the matrix. So far i'm using MLPRegressor from Scikit.The problem is, there's absolutely no pattern in the predicted results.The predicted results include negative numbers, numbers really big and no "pattern" for the indexes whatsoever. Is there a way to adjust these things in the model or the problem is on my dataset? Thank you very much!

Update:

I wasn't very clear about the problem, so i'll try to explain it better.

About the problem: Predict water distribution in irrigation systems. I already have a program to simulate this, and works with rather good precision. The challenge now was to make an AI model to simulate this, instead of the old methods.

About the inputs: Inputs are one float representing the pressure of the sprinkler used to distribute water, two floats representing the speed and angle of the wind at the time data was collected. The 4 remaining are numbers representing some configuration of the sprinker (these numbers change very little between instances, but they do have impact in the result, which is why i decided to mantain them in the dataset).

About the output: Output is an array of 144 elements, representing the 12*12 matrix. Each element of the matrix contain a number representing the amount of water that was collected in that point. These collectors where evenly spread around the sprinkler. So the position of the matrix matter a lot, since in most cases the first and last lines and columns will have 0 or a close to 0 (but positive) number - this may vary depending especially on the speed and angle of the wind, but also on the sprinkler.

About the dataset: I have available 75 instances. They are all stored in a CSV file, where the 7 inputs and the 144 outputs are, each in one line.

$\endgroup$
  • $\begingroup$ I think that MLP is not a suitable solution in your case and autoencoders are more suitable for your task. However, no guarantees that even AE with the best architecture will work, since it’s not a fact, that your input data contains enough information for such reconstruction. However, if you don’t insist on MPL and can consider using AE instead, I can give you an answer with suggestions how doing it. If you can share your data I even can check it and give you more precise answer . You can find the simple CAE sample here - stackoverflow.com/questions/46921246/issue-with-simple-cae $\endgroup$ – Stepan Novikov Oct 25 '17 at 12:25
  • $\begingroup$ Just updated op with more details. Will do some reading about AE. Thank you! $\endgroup$ – Fuga Oct 25 '17 at 16:50
  • $\begingroup$ I think that 75 examples is not enough for good accuracy, therefore it probably can be up to 80-90% for a such small dataset. However, could you share your dataset, so I will be able to test model with it? $\endgroup$ – Stepan Novikov Oct 26 '17 at 13:14
2
$\begingroup$

The short answer to your question is: you probably do not fully know your data. remember that ML is no magic wand. It needs your understanding of the data and the behavior of it. Although it is approved that neural networks with at most two hidden layers can approximate any model with an acceptable degree precision, setting up the structure of the neural network is still your task; also note that the cleaner your data is, the more acceptable the degree of precision will be for a structured NN.

the following more detailed explanation might also help. understanding your data that I pointed above, means:

  1. the design of your machine learning pipeline is the first and most important thing to take care of. Are you sure you have handled training set and test set appropriately? are the ratios standard? have you performed random sampling well?

  2. the size of the dataset is also a matter of consideration. remember a ratio of n/p>10 (n: the number of instances, p: the number of features) is necessary. So if you have 7 features, you should have more than around 100 instances. check how big is your dataset

  3. the distribution of your dataset is also important. dealing with badly distributed data should be considered if you have an issue here. use plots and histograms to understand the distribution of your dataset over feature axes. There is a high risk of overfitting if your data is distributed badly

  4. also take care of your output distribution. with a bad distribution over your output data (focused outputs in a zone) you loose the power of generalization of your model

  5. check the relations between different features. check if there are any pairs of dependent variables. you can use scatter plot or calculating pairwise covariances. PCA or more complicated methods (like auto-encoders) will be of help if there is any issue here

  6. one possibility is maybe your data doesn't carry any latent information at all. maybe the underlying pattern is so stochastic and nonlinear that it seems to be random. in other words: you can not predict what kind of food your grandma has cooked by looking at results of world cup games, no matter how big your dataset is.

Now about your output matrix:

reshaping your matrix to an array of 144 might be the best or the worst thing to do. it depends on the characteristics of your data. maybe the position of each element in the matrix is also important in predicting the value. so you might want to include the i,j of each element in the input array too. maybe each output also takes effect from neighbors. there are some other options to consider:

  1. you can use 144 different MLP networks, one for each element (a little bit like what you have already done, when reshaping your matrix. since your library constructs a single MLP network that has 144 neurons in the output layer. so it seems like 144 networks that only vary in the output layer, and note that the weight correction step is different too, since the training error for all of the outputs propagate back in the layers simultaneously)

  2. you can create 144 instances out of each instance, each of which has 7+2 inputs and 1 output. the 2 more inputs are the position of the output value (i,j). it might be a poor decision to do that but this method has helped me a couple of times, so test it

  3. Do the second step, but include the neighbor values too. so you'd have for example 7+2+4 inputs (7 initial + 2 i,j + 4 neighbor values)

  4. also consider using RNNs (recurrent neural networks). if you consider the matrix to be a sequence of values which has internal dependency plus the external dependency to those 7 features, then you can use a RNN network like LSTM.

feel free to update your post with more specific experiments and issues.

$\endgroup$
  • $\begingroup$ Updated op with more details about the problem. But i'll do some more tests considering your points, they helped a lot and made me think better about the problem. Thank you very much! $\endgroup$ – Fuga Oct 25 '17 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.