Linear Regression Health Costs Calculator ERROR

As far as I am aware I have built my model however I am getting this error when I try to check it:

TypeError                                 Traceback (most recent call last)
<ipython-input-75-480afcf9bc78> in <module>()
      1 # RUN THIS CELL TO TEST YOUR MODEL. DO NOT MODIFY CONTENTS.
      2 # Test model by checking how well the model generalizes using the test set.
----> 3 loss, mae, mse = model.evaluate(test_dataset, test_labels , verbose=2)
      4 
      5 print("Testing set Mean Abs Error: {:5.2f} expenses".format(mae))

TypeError: evaluate() got an unexpected keyword argument 'verbose'

This is from the given code in the doc - my code is here: Working-with-data-/fcc_predict_health_costs_with_regression.ipynb at main · lilaceri/Working-with-data- · GitHub

Thanks!

It appears your model is defined as

model = tf.estimator.LinearRegressor(feature_columns=feature_columns)

just before your error. The documentation for this model’s evaluate() method does not list verbose as a keyword argument, hence the error. However, the tf.keras.Sequential model you used earlier does support this usage.

1 Like

Hi lilacerirose,
English is not my native language,so you may not understand what I mean.

If your code like this:

model.compile(loss="loss_function1", metrics="loss_function2")

It will return:

loss_function1, loss_function2 = model.evaluate(...)

If your code like this:

model.compile(loss="loss_function1", metrics=["loss_function2", "loss_function3"])

It will return:

loss_function1, loss_function2, loss_function3 = model.evaluate(...)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.