How can I go about building a model for large number of outputs?

I have previously worked on small-scale feedforward neural network problems.

But I have started working on a new project where the goal is to predict air quality in 25 locations throughout the country a day ahead. Now, I am quite well-versed with the air quality side of things.

My question:

In a problem like this, would I develop 25 independent models (which share the same input structure) or one model with 25 outputs.

I guess what I want to do - is there something like parallel neural networks? Or is this 25 different problems? I have mostly worked on physical models where the physics would be shared by all 25 locations. And the inputs would be different.

Would this be a data parallelism or a model parallelism problem?

Topic rnn forecast

Category Data Science


There are few model types which allow for "multi output" regression/classification.

The sklearn docs come with a nice overview:

enter image description here

However MultiOutputRegressor simply fits one regressor per target. While with RegressorChain

Each model makes a prediction in the order specified by the chain using all of the available features provided to the model plus the predictions of models that are earlier in the chain.

Keras' functional API allows to model several targets simultanously. The general structure of such models is (full minimal example here):

# Input and model architecture
Input_1=Input(shape=(YOUR_SHAPE_HERE, ))
x = LAYERS_HERE

# Outputs
out1 = Dense(1)(x)
out2 = Dense(1)(x)

# Compile/fit the model
model = Model(inputs=Input_1, outputs=[out1,out2])
model.compile(optimizer = "rmsprop", loss = 'mse')

# Add actual data in the fit statement
model.fit(train_data, [train_targets,train_targets2], epochs=500, batch_size=4, verbose=0, validation_split=0.2)

Neural networks can have 25 outputs. You would probably get a slightly more accurate result with 25 independent models, but the computation and training time would be 25x of one independent model. One model with 25 outputs would only take slightly longer than one independent model.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.