Predict function

I can not implement the prediction function how can I implement it ?

Hey @Amr_Ahmed3,
Welcome to the community. You will find that the optional (ungraded) labs might help you a lot in this. They often teach the concepts along with their implementation in a crystal-clear way, so that the learners have all the tools in their arsenal that they require to complete the assignment. Hence, you can always go back and take a look at the optional labs once again. Additionally, you can check out the hints given in the notebook for the predict function. They will also guide you around the implementation of the function. Another thing that you could do is to watch the lecture videos again, since you will find that Prof Andrew has clearly explained each of the things that the learners are expected to implement in the assignment. Lastly, if you are still unable to implement the function and facing any particular error, you can always post the traceback of your error here, and we will help you out. I hope this helps.

Cheers,
Elemento

there only an example for how to implement predict function for linear but there is not for logistic
in code not as equation I mean

Hey @Atem_Liai_Aler,
Welcome to the community. I never stated that the code for the predict function can be found in the optional labs. But if you have followed the videos and the optional labs carefully, then I don’t think you should have much of an issue implementing the predict function by yourself for Logistic Regression. But if you are facing any particular issue, please do let us know, we will be more than happy to help you out.

Cheers,
Elemento

But Why all of this when the once can do it with a rogr.predict
From sklearn .
by the way am I allow to use that ?

Hey @Atem_Liai_Aler,
If the assignments only showed you the code to use sklearn models, then if someday you needed to change the model by yourself, you will find yourself to be stranded in the middle of a desert, don’t you think? For instance, in the sklearn.linear_model.LinearRegression, there is no support for Regularization. What if someone asks you to implement that? Will you be able to do that hadn’t you implemented these models from scratch by yourself?

Moreover, implementing these simple models by scratch from yourself gives you confidence to create new models by yourself, models that haven’t been created yet, and hence, you won’t be able to find their implementations in any packages. I hope you have got the gist by now.

As to this, surely if you train a sklearn model, then you can use the predict function from that, but since the assignment trains the model from scratch, hence, you won’t be able to use that in the assignment. I hope this helps.

Cheers,
Elemento

1 Like

ok thanks for your replay
I will try to do that