Week 4 Grading Shape Error

There was a problem grading your submission. Details:
Incompatible shapes: [1150,64] vs. [1150] [Op:SquaredDifference]

Hints, I change the original code from
rnn_forecast = rnn_forecast[G.SPLIT_TIME - G.WINDOW_SIZE:-1]
to
rnn_forecast = rnn_forecast[G.SPLIT_TIME - G.WINDOW_SIZE:-1,0]

to make sure the metrics can be calculated, but after I submit my grade was 0, Even I have made reach the MAE.

Any idea how to fix?

My model summary

Model: “sequential_12”


Layer (type) Output Shape Param #

conv1d_12 (Conv1D) (None, None, 60) 360

lstm_24 (LSTM) (None, None, 60) 29040

lstm_25 (LSTM) (None, None, 60) 29040

dense_36 (Dense) (None, None, 30) 1830

dense_37 (Dense) (None, None, 10) 310

dense_38 (Dense) (None, None, 1) 11

lambda_12 (Lambda) (None, None, 1) 0

=================================================================
Total params: 60,591
Trainable params: 60,591
Non-trainable params: 0

Do not change code other than places where you’re asked to.

See the differences in BATCH_SIZE and WINDOW_SIZE

This is the definition of class G in the starter code:

@dataclass
class G:
    TEMPERATURES_CSV = './data/daily-min-temperatures.csv'
    times, temperatures = parse_data_from_file(TEMPERATURES_CSV)
    TIME = np.array(times)
    SERIES = np.array(temperatures)
    SPLIT_TIME = 2500
    WINDOW_SIZE = 64
    BATCH_SIZE = 256
    SHUFFLE_BUFFER_SIZE = 1000

This is the version in your notebook:

@dataclass
class G:
    TEMPERATURES_CSV = './data/daily-min-temperatures.csv'
    times, temperatures = parse_data_from_file(TEMPERATURES_CSV)
    TIME = np.array(times)
    SERIES = np.array(temperatures)
    SPLIT_TIME = 2500
    WINDOW_SIZE = 30
    BATCH_SIZE = 32
    SHUFFLE_BUFFER_SIZE = 1000

Similarly, you’ve changed code in windowed_dataset. This is the version in starter code:
ds = ds.map(lambda w: (w[:-1], w[-1]))
This is your notebook version:
ds = ds.map(lambda w: (w[:-1], w[1:])).

I recommend you start with a fresh copy of the assignment and code only at the right places.
See Refresh your Lab Workspace section here

Hi, I changed my code because having trouble in calculating MAE and have the error message for my jupyter lab.

I send you the original code (without changing anything original, but it have error on calculating mae)

Just saw your notebook. Adjust your model architecture to produce the expected output shape.