[FEATURE REQUEST] Add Perceptron binary classifier
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 78/100
- Tipo de issue
- Funcionalidade
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- java
- Domínio
- machine-learning
Direção de pesquisa
Comece lendo as implementações existentes de LinearRegression, KNearestNeighbors e MultinomialNaiveBayesClassifier em src/main/java/com/thealgorithms/machinelearning e, em seguida, revise o pull request histórico para obter contexto. Adicione Perceptron.java com testes seguindo as convenções do repositório; considera-se concluído quando dados separáveis, previsões para dados não vistos e em lote, falhas antes do ajuste e para entradas inválidas e o comportamento documentado para dados não separáveis funcionarem.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 66.3k
- Forks
- 21.3k
- Merge médio
- 16h 57min
- PRs com merge (30d)
- 23
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TheAlgorithms/Java
-
enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 78/100
TheAlgorithms/Java#7588 · 2 comentários ·
-
enhancement
TheAlgorithms/Java#7579 · 4 comentários · 2 responsáveis ·
-
hacktoberfest help wanted
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 1/100
TheAlgorithms/Java#7546 · 5 comentários ·
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 20/100
TheAlgorithms/Java#6974 · 3 comentários ·
Todas as issues de TheAlgorithms/Java
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
bug needs triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 94/100
objectionary/hone-maven-plugin#1061 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
spring-projects/spring-modulith#1895 ·