Stephen Ryan
Stephen Ryan

Reputation: 173

Convolutional Neural Network with Extra Parameters

I'm attempting to train a CNN to predict the ground (equilibrium) state of a 2D Ising model at a given temperature. Essentially, a square matrix is randomly initialised, with two possible values. Under a set of rules, the system evolves over time to a equilibrium.

The issue is that the ground state depends on the temperature, and the CNN needs to know the temperature. Is it possible to create a CNN that takes the temperature and matrix as input, and outputs the equilibrium?

I intend to use Keras, if that matters.

Upvotes: 1

Views: 542

Answers (1)

sladomic
sladomic

Reputation: 876

First do your operations on the separate inputs (e.g. convolutions), then concatenate them before feeding the final dense layers.

input_1 = Input(shape=(100, 100, 1), name="matrix")
input_2 = Input(shape=[1], name="temperature")

matrix = Conv2D(24, kernel_size = 3, strides = 2, padding='same', activation='relu')(input_1)

concat = Concatenate()([matrix, input_2])

dense_layer = Dense(512, activation='relu')(concat)
output = Dense(num_classes, activation='softmax')(dense_layer)

model = Model([input_1,input_2], output)

Upvotes: 3

Related Questions