@@ -19,19 +19,15 @@ def deps do
1919end
2020```
2121
22- ### K-Nearest Neighbours
22+ ### K-Nearest Neighbours classification
2323
2424Initialize classificator with data set consists from labels and features:
2525
2626``` elixir
2727 classificator = LearnKit .Knn .new
2828 |> LearnKit .Knn .add_train_data ({:a1 , [- 1 , - 1 ]})
2929 |> LearnKit .Knn .add_train_data ({:a1 , [- 2 , - 1 ]})
30- |> LearnKit .Knn .add_train_data ({:a1 , [- 3 , - 2 ]})
3130 |> LearnKit .Knn .add_train_data ({:a2 , [1 , 1 ]})
32- |> LearnKit .Knn .add_train_data ({:a2 , [2 , 1 ]})
33- |> LearnKit .Knn .add_train_data ({:a2 , [3 , 2 ]})
34- |> LearnKit .Knn .add_train_data ({:a2 , [- 2 , - 2 ]})
3531```
3632
3733Predict label for new feature:
@@ -44,6 +40,43 @@ Predict label for new feature:
4440 algorithm - algorithm for calculation of distances, one of the [brute], optional, default - "brute"
4541 weight - method of weighted neighbors, one of the [uniform|distance], optional, default - "uniform"
4642
43+ ### Gaussian Naive Bayes classification
44+
45+ Initialize classificator with data set consists from labels and features:
46+
47+ ``` elixir
48+ classificator = LearnKit .NaiveBayes .Gaussian .new
49+ |> LearnKit .NaiveBayes .Gaussian .add_train_data ({:a1 , [- 1 , - 1 ]})
50+ |> LearnKit .NaiveBayes .Gaussian .add_train_data ({:a1 , [- 2 , - 1 ]})
51+ |> LearnKit .NaiveBayes .Gaussian .add_train_data ({:a2 , [1 , 1 ]})
52+ ```
53+
54+ Fit data set
55+
56+ ``` elixir
57+ classificator = classificator |> LearnKit .NaiveBayes .Gaussian .fit
58+ ```
59+
60+ Return probability estimates for the feature
61+
62+ ``` elixir
63+ classificator = classificator |> LearnKit .NaiveBayes .Gaussian .predict_proba ([1 , 2 ])
64+ ```
65+ feature - new feature for prediction, required
66+
67+ Return exact prediction for the feature
68+
69+ ``` elixir
70+ classificator = classificator |> LearnKit .NaiveBayes .Gaussian .predict ([1 , 2 ])
71+ ```
72+ feature - new feature for prediction, required
73+
74+ Returns the mean accuracy on the given test data and labels
75+
76+ ``` elixir
77+ classificator = classificator |> LearnKit .NaiveBayes .Gaussian .score
78+ ```
79+
4780## Contributing
4881
4982Bug reports and pull requests are welcome on GitHub at https://github.com/kortirso/elixir_learn_kit .
0 commit comments