[FEATURE REQUEST] Add Perceptron binary classifier
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Bắt đầu bằng cách đọc các triển khai LinearRegression, KNearestNeighbors và MultinomialNaiveBayesClassifier hiện có trong src/main/java/com/thealgorithms/machinelearning, sau đó xem lại pull request trước đây để hiểu bối cảnh. Thêm Perceptron.java cùng với các bài kiểm thử tuân theo quy ước của repository; công việc được xem là hoàn tất khi dữ liệu phân tách được, các dự đoán trên dữ liệu chưa từng thấy và dự đoán theo batch, các lỗi trước khi fit và đối với đầu vào không hợp lệ, cũng như hành vi đã được ghi nhận đối với dữ liệu không phân tách được, đều hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What would you like to Propose?
Add a Perceptron classifier to src/main/java/com/thealgorithms/machinelearning. The Perceptron is the simplest neural network and would provide an educational binary linear-classification algorithm alongside the existing LinearRegression, KNearestNeighbors, and MultinomialNaiveBayesClassifier implementations.
Issue details
Algorithm name: Perceptron
Problem statement: Given a set of feature vectors and binary class labels, learn a linear decision boundary using the Perceptron learning rule, then classify previously unseen samples. The implementation should make the bias term explicit and document that convergence is guaranteed only for linearly separable data.
Suggested scope:
- Add
Perceptron.javain the machinelearning package. - Use only the Java standard library; no external machine-learning dependency is needed.
- Provide a small, clear API for fitting, predicting one sample, and predicting a batch.
- Support configurable learning rate and maximum epochs, with deterministic zero-weight and zero-bias initialization.
- Validate null or empty data, inconsistent feature dimensions, invalid labels, and invalid hyperparameters with clear exceptions.
- Document the update rule, label convention, and limitations in Javadoc.
Acceptance tests:
- Train on a linearly separable toy dataset such as AND or OR and classify all training samples correctly.
- Verify predictions for unseen samples and batch prediction.
- Verify that prediction before fitting fails clearly.
- Verify invalid labels, mismatched dimensions, null or empty input, and invalid learning-rate or epoch values.
- Include a non-separable-data test that checks documented behavior, such as stopping after the epoch limit without claiming convergence.
A historical pull request, #187, attempted a Perceptron implementation in 2018, but there is no current implementation in the package. This request is for a current Java 21 implementation with tests that follow the repository conventions.
- Ngôn ngữ chính
- Java
- Star
- 66.3k
- Fork
- 21.3k
- Merge trung bình
- 16 giờ 57 phút
- Pull request đã merge (30 ngày)
- 23
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TheAlgorithms/Java
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
TheAlgorithms/Java#7588 · 2 bình luận ·
-
enhancement
TheAlgorithms/Java#7579 · 4 bình luận · 2 người được giao ·
-
hacktoberfest help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 1/100
TheAlgorithms/Java#7546 · 5 bình luận ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
TheAlgorithms/Java#6974 · 3 bình luận ·