# Naive Bayesian Classifier in APL

© 2015-2016 Matthew Cunningham

## About

This is a *simple* naive bayesian classifier to gain independent probabilistic assumptions on test input. The classifier requires precisely *2* groups with training data. This is just a fun side project I did over the weekend, but any contributions would be **fantastic**.

There are three files in this repository — each file works on its own:

*bayes.min.apl*- This is the completely minified version.*bayes.apl*- This file isn't as obfuscated as the minified version, but it still follows conventional minified APL practices.*bayes.full.apl*- Fully documented

## Example

This example shows the classifier displaying the independent probabilistic assumptions on whether given text aligns with keywords of *two* different animals: *cat* or *dog*.

```
$ ("meow purr hiss bad animal" 0) ("bark grr howl good animal" 1) b "I am an animal and I hiss"
0.9999999995 4.999999994999999e¯10
```

Try out this example using ngn/apl's online interpreter.

The provided training data is the keywords and groups, with cat being the 0th index and dog being the 1st index. The test data consists of a string that contains keywords to align with a certain training group; in this example, cat is the classified group.