Skip to content

Perceptron #15206

Description

@cclauss

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?

Activity

  1. priya-sundaram-dev commented on Sep 6, 2026

    @priya-sundaram-dev
    Contributor

    Here's the current Perceptron landscape and what I'd recommend, @cclauss.

    What's in the tree today

    1. 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 in DIRECTORY.md. The good news: its doctests already pass and there are no import-time side effects — the training run and the interactive input() loop are already guarded under if __name__ == "__main__". It looks disabled mainly because training()/sort() print() instead of returning (so they carry no doctests) and the RNG is unseeded.

    2. machine_learning/multilayer_perceptron_classifier.py — 29 lines that just call sklearn.neural_network.MLPClassifier and 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

    Recommendation — one from-scratch perceptron per level, both legitimate:

    Net target: neural_network/perceptron.py (single-layer) + one from-scratch MLP in machine_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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions