Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classifier unlearn #220

Merged
merged 4 commits into from
Jan 9, 2025
Merged

Classifier unlearn #220

merged 4 commits into from
Jan 9, 2025

Conversation

umputun
Copy link
Owner

@umputun umputun commented Jan 9, 2025

This is another optimization eliminating the need for a full sample reload on removal and instead applying "unlearn" as a part of the classifier. With this change, the only time a complete reload is needed is on startup.

Introduce an `unlearn` method to the classifier, allowing removal of previously learned documents and adjusting internal state accordingly. Include comprehensive test cases to verify functionality under various scenarios, ensuring consistency and error handling in the learning process.
- Add `Remove` method to `SampleUpdater` interface for deleting messages from sample storage.
- Update `Detector` to support unlearning of samples upon their removal.
- Modify tests to include scenarios for removing messages and verifying probability consistency.
- Refactor `SpamFilter` to use new `RemoveHam` and `RemoveSpam` methods in detector.
- Ensure message-related operations are executed with proper context and error handling.
Copy link

cloudflare-workers-and-pages bot commented Jan 9, 2025

Deploying tg-spam with  Cloudflare Pages  Cloudflare Pages

Latest commit: b05ee35
Status: ✅  Deploy successful!
Preview URL: https://c0fcf99b.tg-spam.pages.dev
Branch Preview URL: https://classifier-unlearn.tg-spam.pages.dev

View logs

@umputun umputun merged commit 8ac0c1a into master Jan 9, 2025
2 of 3 checks passed
@umputun umputun deleted the classifier-unlearn branch January 9, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant