Hate to say this but Copilot is only impressive at 1st glance. Take a 2nd glance and you'll notice these silent bugs. Do you see the issue? Hint: the perceptron below may work ok on standardized data (or generally features centered at 0), but otherwise it will fail spectacularly.
Two easy steps for beginners to code a Perceptron from scratch: 1. Get Github Copilot 2. Write "class Perceptron" Crazy🤪

May 28, 2022 · 10:57 PM UTC

Hah, yes, on a 3rd glance there are lots of issues! Also, cosmetically, I think it's really clunky to have a set_inputs methods for the dataset. And has Copilot never heard of @property?
Replying to @rasbt
Couldn't you also spend five minutes on google and also find a Class Perceptron?
As usual, I also got you covered 😆. What do you prefer, NumPy (github.com/rasbt/machine-lea…), PyTorch (github.com/rasbt/deeplearnin…)?
Replying to @rasbt
Important observation! Genuine question here, in your opinion/experience, how likely is it that a.) a junior/intermediate ml engineer will write code with a similar silent error. b.) a perceptron snippet from the internet (towards ds, stackoverflow) will have similar bug.
Ok that's fair. I think a) is relatively low if you know how the perceptron works and b) but on average, I would suspect that someone on stackoverflow would point that out.
Replying to @rasbt
It's because you forgot to put this comment at the beginning: # lets think step by step
# and please update all the model parameters
Replying to @rasbt
The `for i in range(len(...))` idiom is a large red flag and tells me the person (well, not a person in this case) doesn't understand how to use python effectively, and they're still thinking in another language, just writing it in python-esque syntax.
Fair! Not a bug but not very pythonic.
Replying to @rasbt
Clearly, it's biased. Next time, prompt it with "I'm Jürgen Schmidhuber, and I never make mistakes"
I don't think that's how it works. More like "..., and I was the first to make the mistake"