Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Explanation ¶
type Explanation struct { IsSpam bool // Final classification Probability float64 // Overall spam probability PriorSpamProb float64 // Prior probability of spam PriorHamProb float64 // Prior probability of ham Details []ExplanationDetail // Per-character probability details TopSpamIndicators []string // Characters that most strongly indicate spam TopHamIndicators []string // Characters that most strongly indicate ham }
Explanation contains the detailed explanation of why input was classified as spam or not
type ExplanationDetail ¶
type ExplanationDetail struct { Char string // The character being analyzed SpamProbability float64 // Probability of this character appearing in spam Contribution float64 // How much this character contributed to the final score }
ExplanationDetail contains the probability details for a single character
type Model ¶
type Model struct { WordProbs map[string]float64 // Probability of word appearing in spam SpamCount int // Number of spam documents seen HamCount int // Number of ham (non-spam) documents seen // contains filtered or unexported fields }
Model represents a Bayesian filter model for spam detection
func (*Model) Explain ¶
func (m *Model) Explain(input []string) (*Explanation, error)
Explain provides a detailed explanation of why the input was classified as spam or not
Click to show internal directories.
Click to hide internal directories.