Repository navigation
Perceptron #15206
Description
Activity
- addedenhancementThis PR modified some existing filesThis PR modified some existing files
on Sep 6, 2026 Here's the current Perceptron landscape and what I'd recommend, @cclauss.
What's in the tree today
-
neural_network/perceptron.py.DISABLED— a genuine from-scratch single-layer (Rosenblatt) perceptron. This is exactly the kind of algorithm the repo exists to teach. It's currently disabled and not inDIRECTORY.md. The good news: its doctests already pass and there are no import-time side effects — the training run and the interactiveinput()loop are already guarded underif __name__ == "__main__". It looks disabled mainly becausetraining()/sort()print()instead of returning (so they carry no doctests) and the RNG is unseeded. -
machine_learning/multilayer_perceptron_classifier.py— 29 lines that just callsklearn.neural_network.MLPClassifierand assert one hard-coded prediction. It doesn't implement an MLP, so its educational value is ~nil and it leans against our "implement it, don't wrap a library" norm.
Open PRs
- Add implementation of the multi-layer perceptron classifier from scratch #12756 (@duuan) —
multilayer_perceptron_classifier_from_scratch.py, +517, a real from-scratch NumPy MLP. If it holds up in review, this is the correct replacement for the sklearn wrapper. - multilayer_perceptron_classifier #10387 (@Saswatsusmoy) — only polishes the sklearn wrapper (+57/−18). Still a wrapper.
Recommendation — one from-scratch perceptron per level, both legitimate:
- Single-layer: revive
neural_network/perceptron.py— refactortraining()/sort()to return values with doctests, seed the RNG, add it back toDIRECTORY.md. Self-contained, good-first-issue-sized. - Multilayer: prefer a from-scratch MLP over the sklearn wrapper. Review Add implementation of the multi-layer perceptron classifier from scratch #12756 on its merits; if it passes, merge it and remove
multilayer_perceptron_classifier.py+ close multilayer_perceptron_classifier #10387 (wrapper-only). If Add implementation of the multi-layer perceptron classifier from scratch #12756 isn't up to standard, keep the wrapper as a stopgap, but that's the file to replace.
Net target:
neural_network/perceptron.py(single-layer) + one from-scratch MLP inmachine_learning/— two legitimate implementations, zero sklearn wrappers.Happy to take the single-layer revival PR and do a review pass on #12756 if that's useful.
(I'm an AI maintainer — glad to do the concrete work here.)
-
- added a commit that references this issue
on Sep 6, 2026
Feature description
@priya-sundaram-dev, can you please rationalize our approach to Perceptrons?
I am OK with having one neural_network perceptron algorithm and a separate machine learning perceptron algorithm if both are legitimate. Your perceptron recommendations?