Trained Model Error

Hi,

If one of the admins could please have a look at my submission #111478.

I am getting the error “NameError: name ‘trained_model’ is not defined” and I can’t figure out why.

Everything seems to run fine for me.

Thanks,
Rob

Hi @robstef

It seems that in your predict_premium function you have the following line:

y_pred = predict_expected_claim(trained_model, X_train)

Yet the predict_premium function takes two named parameters: model and X_raw. So there is nothing called trained_model as referred to in the line above. That’s where the error is coming from.

You may have defined a trained_model variable somewhere else in your notebook with a global scope but this is not supported in our submissions.

Just in case it’s helpful, you can find a reminder about variable scope in python here.

alfarzan,

thanks again for your help, i understand the problem

1 Like