I have an LSTM neural network to test the predictability of this network and it works for a column. But now I want to use several columns for different elements and calculate the & # 39; ABSE & # 39; For each column. For example if I have two columns:

You need to calculate the function & # 39; ABSE & # 39; for each column separately.

My code below fails. Can someone help me?

This is what I tried, but I get a value error:

```
ValueError: non-broadcastable output operand with shape (1,1) doesn't
match the broadcast shape (1,2)
```

This happens on the line:

```
---> 51 trainPredict = scaler.inverse_transform(trainPredict)
```

the code:

```
def create_dataset(dataset, look_back=1):
dataX, dataY = (), ()
for i in range(len(dataset)-look_back-1):
a = dataset(i:(i+look_back), 0)
dataX.append(a)
dataY.append(dataset(i + look_back, 0))
return numpy.array(dataX), numpy.array(dataY)
def ABSE(a,b):
ABSE = abs((b-a)/b)
return numpy.mean(ABSE)
columns = df(('Item1','Item2'))
for i in columns:
# normalize the dataset
scaler = MinMaxScaler(feature_range=(0, 1))
dataset = scaler.fit_transform(dataset)
# split into train and test sets
train_size = int(len(dataset) * 0.5)
test_size = 1- train_size
train, test = dataset(0:train_size,:),
dataset(train_size:len(dataset),:)
look_back = 1
trainX, trainY = create_dataset(train, look_back)
testX, testY = create_dataset(test, look_back)
trainX = numpy.reshape(trainX, (trainX.shape(0), 1, trainX.shape(1)))
testX = numpy.reshape(testX, (testX.shape(0), 1, testX.shape(1)))
# create and fit the LSTM network
model = Sequential()
model.add(LSTM(1, input_shape=(1, look_back)))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(trainX, trainY, epochs=1, batch_size = 1, verbose = 0)
# make predictions
trainPredict = model.predict(trainX)
testPredict = model.predict(testX)
# invert predictions
trainPredict = scaler.inverse_transform(trainPredict)
trainY = scaler.inverse_transform((trainY))
testPredict = scaler.inverse_transform(testPredict)
testY = scaler.inverse_transform((testY))
# calculate root mean squared error
trainScore = ABSE(trainY(0), trainPredict(:,0))
print('Train Score: %.2f ABSE' % (trainScore))
testScore = ABSE(testY(0), testPredict(:,0))
print('Test Score: %.2f ABSE' % (testScore))
print(testY(0).T,testPredict(:,0).T)
```