is throwing an error with the unittest util.test_history

Here is the unittest that is failing:

def test_history(history):

    vars_history = vars(history)
    test_cases = [
            "name": "type_check",
            "result": type(history),
            "expected": tf.keras.callbacks.History,
            "error_message": 'history type is incorrect. Please check'
            "name": "params_samples_check",
            "result": vars_history['params']['samples'],
            "expected": 3155,
            "error_message": 'Training samples is incorrect. Please check arguments to'
            "name": "params_do_validation_check",
            "result": vars_history['params']['do_validation'],
            "expected": True,
            "error_message": 'No validation data is present. Please check arguments to'

I am trying to run the following. I have blanked out parts that are user inputs

# history =, y=#####,
#                     epochs = 40, validation_data=(#####, #####))

The error I get is the following:

params_samples_check: Training samples is incorrect. Please check arguments to
Expected: 3155
Result: 3250
Please open if you want to see the unit test here.

However if get the length of my input variables I am getting an expected length:

length = [len(data) for data in (norm_train_X, train_Y, norm_val_X, val_Y)]
>> [3155, 2, 789, 2]

You can see above that norm_train_X has a length of 3155, but the input being provided to the unittest is 3250, so it’s unclear what is happening.

I will note that despite the failing unittest, my values fall within acceptable ranges:

# ~ 0.30 - 0.38
# ~ 0.30 - 0.38
# ~ 0.018 - 0.036
# ~ 0.50 - 0.62
# ~ 0.97 - 1.0
789/789 [==============================] - 0s 22us/sample - loss: 0.3397 - wine_quality_loss: 0.3117 - wine_type_loss: 0.0267 - wine_quality_root_mean_squared_error: 0.5591 - wine_type_accuracy: 0.9949

loss: 0.3396697271006189
wine_quality_loss: 0.3116830885410309
wine_type_loss: 0.026737095788121223
wine_quality_rmse: 0.5590964555740356
wine_type_accuracy: 0.9949302673339844

Im not sure either where the issue might be but i suspect maybe in the dataframe conditions in the upper parts of the notebook. You should revisit them once again I advise.

Hello Nick,

Based on your error log, you need to make sure the link you have added wine quality is correct.


It passed the upstream tests for generating the variables. Also submitting the assignment passed all tests. I’m not sure what happened. I’d love to figure out why submitting an array of one length registers as another length in the test. I’m wondering if there’s something I don’t understand about keras.

Hello Nick,

loss = {‘wine_type’ : ,
‘wine_quality’ : ’
metrics = {‘wine_type’ : ,

I hope you used the correct loss according the name type? as your error log mentions issue with the name type

@Nick_VN, that’s so weird!
Is it repeatable? If you try running it again, do you still get the same error?

When I run the…) cell, the first line I see in the output is:

Train on 3155 samples, validate on 789 samples

Do you see the same thing (specifically, the 3155)?

If you’re still seeing the issue, feel free to DM me a copy of your .ipynb file and I’ll see if I can tell what’s going on.