cardmagic / classifier

A general classifier module to allow Bayesian and LSI classifications.
Other
661 stars 122 forks source link

Add classify_with_confidence method to LSI classifier #37

Closed cardmagic closed 4 months ago

cardmagic commented 4 months ago

Changes Overview

These changes primarily focus on enhancing the Latent Semantic Indexing (LSI) classification capabilities. The main modifications include:

  1. Adding a new classify_with_confidence method to the LSI class.
  2. Introducing a vote method to calculate category votes.
  3. Updating the README to showcase the new functionality.
  4. Adding corresponding unit tests for the new features.

Reason for Changes

The changes aim to provide more detailed classification results by including a confidence score alongside the category prediction. This allows users to make more informed decisions based on the classifier's certainty.

Detailed Description

  1. New classify_with_confidence Method - This method extends the existing classify functionality by returning both the predicted category and a confidence score. This enables users to set custom thresholds for accepting or rejecting classifications based on the confidence level.

  2. Introduction of vote Method - The vote method has been extracted from the classify method to calculate category votes. This refactoring improves code reusability and allows both classify and classify_with_confidence to use the same voting logic.

  3. README Update - The README has been updated to include an example of using the new classify_with_confidence method, helping users understand and adopt the new feature.

  4. New Unit Tests - Comprehensive unit tests have been added to ensure the correct functionality of the new classify_with_confidence method across various scenarios.