Skip to content

Tags: jbrukh/bayesian

Tags

v1.1.0

Toggle v1.1.0's commit message
Add dynamic class addition with thread safety (closes #24)

- Add AddClass method to add new classes after classifier creation
- Add RWMutex to protect Classes and datas from concurrent access
- Add locks to all public methods for thread safety:
  - RLock for read operations (LogScores, ProbScores, etc.)
  - Lock for write operations (Learn, Observe, AddClass, etc.)
- Add ErrClassExists and ErrAlreadyConverted error types
- Add comprehensive tests for AddClass functionality
- Add concurrent access tests to verify thread safety

All methods are now safe for concurrent use.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

v1.0.2

Toggle v1.0.2's commit message
Fix numerical underflow/overflow vulnerabilities

- Add Laplace smoothing to getPriors to avoid log(0) for zero priors
- Handle division by zero in ProbScores when all scores underflow
- Improve SafeProbScores with log-sum-exp trick for probability recovery
- Add logScoresToProbs helper for numerically stable probability conversion
- Update tests for new numerical behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

v1.0.1

Toggle v1.0.1's commit message
v1.0.1 - Code quality improvements

Improvements:
- Implement Laplace smoothing for better numerical precision
- Extract common constructor logic (reduced code duplication)
- Fix WriteClassesToFile to properly propagate errors
- Add O_TRUNC flag to file writes to prevent stale data

Test coverage: 99.5%

🤖 Generated with [Claude Code](https://claude.com/claude-code)

v1.0.0

Toggle v1.0.0's commit message
v1.0.0 - First stable release

This release modernizes the bayesian library for modern Go:

- New Classify, ClassifyProb, ClassifySafe methods that return Class directly
  instead of an index (addresses #15)

- Added go.mod with Go 1.22 minimum version
- Added GitHub Actions CI (tests on Go 1.22 and 1.23)
- 100% test coverage
- Renamed WriteTo to WriteGob for clarity

- Fixed variadic argument forwarding in test helper
- Fixed typos in comments

- WriteTo method renamed to WriteGob
- Minimum Go version is now 1.22

Full documentation: https://pkg.go.dev/github.com/jbrukh/bayesian

1.0

Toggle 1.0's commit message
Added documentation.

0.9

Toggle 0.9's commit message
Minor cosmetic changes, tidied up interface.