Housing price week 1

hi…
I’m working on a new note on house price predictions. But mine has a problem and it doesn’t work. It always say " numpy.ndarray’ object has no attribute ‘predict’

How do i solve it? Could anyone help me, please?

1 Like

To answer your question, we need to know how you defined model
It looks like you define it as a numpy array instead of a tensorflow model.

Perfect ! Now we can understand what’s going on.

It may be a Python misunderstanding about what function definitions do. Nothing really bad :blush:
What

def somefunction(arguments):
    ...
    return objectreturned

does is defining some prototype defined further. But nothing in somefunction , arguments or objectreturned as been created as a variable. So if one of this name exists as a variable, it comes from a previous definition.

In your case, maybe you though that the return model line created a model object ?

It doesn’t. For that, you have to call your function house_model() and store the result in a model variable. (model = house_model())

I hope it helps! Good work :blush: