# Output vector size of a LSTM

Is the size of the output vector of all machine learning algorithms the same? Can't an ML algorithm predict only one value as output?

I have trained an LSTM network with X, Y, heading, speed(from taxi sensor) against feature_x, feature_y. So given a point, I can predict the next one.

Given the LSTM is many-to-one type how does it produce two values as output(x,y)?

Could an MLP also do that?

• Welcome to DS StackExchange. Please explain in detail your task, your dataset, what you tried so far, and what outcomes you got. At the moment it's not very clear. – Leevo May 11 at 8:36
• Still confused about your problem. What do feature_x and feature_y represent? Are you trying to predict the movement of a taxicab? As in, if the cab was going a certain speed at these coordinates, it will end up at these coordinates next? Can you also show us the architecture of the network you are using? Maybe the code you use to create it? – Valentin Calomme May 11 at 8:36

• Is the size of the output vector of all machine learning algorithms the same?

No, the output vector depends on the architecture that you define, which should itself be dependent on the data that you have.

• Can't an ML algorithm predict only one value as output?

Absolutely it can. Think for instance of regression problems. I cannot think of any algorithms that don't allow you to have an arbitrary sized output vector.

• Given the LSTM is many-to-one type how does it produce two values as output(x,y)?

I don't think you are using "many-to-one" correctly in this case. It seems that you have a single input which happens to be a time-series and you want to predict a vector containing two values, so it is in fact a "one-to-one" problem.

A network can produce as many outputs as you want. It all depends on the architecture.

• Could an MLP also do that?

Yes, absolutely. RNNs are essentially a specific way to use MLPs to achieve a specific purpose (in this case, use the positional information). SO anything an LSTM can do could be replicated using MLPs.