Last active
October 17, 2021 17:48
-
-
Save Saransh-cpp/13ff1c4659c4e670109b1f5a1f063c7e to your computer and use it in GitHub Desktop.
Predict function for [logistic regression as a neural network](https://whiteviolin.medium.com/implementing-logistic-regression-as-a-neural-network-from-scratch-eff9d9cc98bc) article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def predict(self, x): | |
""" | |
Predicts the y values based on the training data. | |
""" | |
prediction = [] | |
for single_data in x: | |
prediction.append( | |
1 if self.sigmoid(np.dot(single_data, self.W) + self.b) > 0.5 else 0 | |
) | |
return prediction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment