Skip to content

Instantly share code, notes, and snippets.

@Saransh-cpp
Last active October 17, 2021 17:48
Show Gist options
  • Save Saransh-cpp/13ff1c4659c4e670109b1f5a1f063c7e to your computer and use it in GitHub Desktop.
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
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