Classification algorithms.
cv
predict
validate
Classifier parameters are map of values specific for given algorithm. Check documentation in backend library to find documentation. Classifier can be retrained using train
. New instance will be created.
Classifier training is delayed to the actual use. To force training, call train
or predict
.
Every classifier exposes it's own cross validation method with configuration cv
.
~~Additionally three Clojure level methods are defined: cv
, [[loocv]] and [[bootstrap]].~~
What is missed:
Native cross validation config is a map with keys:
:k
- number of folds (default: 10):type
- type of cross validation, one of :cv
(default), :loocv
and :bootstrap
https://github.com/bwaldvogel/liblinear-java
Native cross validation expects a number as number of folds (default: 10)
Iris database is used.
Classification algorithms. ### Input data * features - sequence of sequences of numbers * categories - sequence of any values ### Workflow * create classifier with parameters * cross validate [[cv]] * repeat or [[predict]] * to validate model against test data, call [[validate]] Classifier parameters are map of values specific for given algorithm. Check documentation in backend library to find documentation. Classifier can be retrained using [[train]]. New instance will be created. Classifier training is delayed to the actual use. To force training, call [[train]] or [[predict]]. ### Implementation notes * only doubles as input data * categories can be any type ### Cross validation Every classifier exposes it's own cross validation method with configuration [[cv]]. ~~Additionally three Clojure level methods are defined: [[cv]], [[loocv]] and [[bootstrap]].~~ ### SMILE [documentation](https://haifengl.github.io/smile/classification.html) What is missed: * other types than doubles (attributes) * maxent * Online classifiers * General Naive Bayes Native cross validation config is a map with keys: * `:k` - number of folds (default: 10) * `:type` - type of cross validation, one of `:cv` (default), `:loocv` and `:bootstrap` ### Liblinear https://github.com/bwaldvogel/liblinear-java Native cross validation expects a number as number of folds (default: 10) ### Examples Iris database is used.
(accuracy t p)
Calculate accuracy for real and predicted sequences.
Calculate accuracy for real and predicted sequences.
List of activation functions for neural-net
.
List of activation functions for [[neural-net]].
(ada-boost x y)
(ada-boost {:keys [number-of-trees max-nodes]
:or {number-of-trees 500 max-nodes 2}}
x
y)
ada-boost classifier. Backend library: smile
ada-boost classifier. Backend library: smile
(backend model)
Return name of backend library
Return name of backend library
(confusion-map t p)
Create confusion map where keys are pairs of [truth-label prediction-label]
Create confusion map where keys are pairs of `[truth-label prediction-label]`
(data-native model)
Return data transformed for backend library.
Return data transformed for backend library.
(decision-tree x y)
(decision-tree {:keys [max-nodes node-size split-rule]
:or {max-nodes 100 node-size 1 split-rule :gini}}
x
y)
decision-tree classifier. Backend library: smile
decision-tree classifier. Backend library: smile
List of error functions for neural-net
.
List of error functions for [[neural-net]].
(fld x y)
(fld {:keys [dimensionality tolerance] :or {dimensionality -1 tolerance 1.0E-4}}
x
y)
fld classifier. Backend library: smile
fld classifier. Backend library: smile
(gradient-tree-boost x y)
(gradient-tree-boost
{:keys [number-of-trees shrinkage max-nodes subsample]
:or {number-of-trees 500 shrinkage 0.005 max-nodes 6 subsample 0.7}}
x
y)
gradient-tree-boost classifier. Backend library: smile
gradient-tree-boost classifier. Backend library: smile
(knn x y)
(knn {:keys [distance k] :or {distance (EuclideanDistance.) k 1}} x y)
knn classifier. Backend library: smile
knn classifier. Backend library: smile
(lda x y)
(lda {:keys [priori tolerance] :or {priori nil tolerance 1.0E-4}} x y)
lda classifier. Backend library: smile
lda classifier. Backend library: smile
(liblinear x y)
(liblinear
{:keys [solver bias C eps max-iters p weights]
:or
{solver :l2r-l2loss-svc-dual bias -1 C 1.0 eps 0.01 max-iters 1000 p 0.1}}
x
y)
liblinear classifier. Backend library: liblinear
liblinear classifier. Backend library: liblinear
List of liblinear
solvers.
List of [[liblinear]] solvers.
(logistic-regression x y)
(logistic-regression {:keys [lambda tolerance max-iterations]
:or {lambda 0.0 tolerance 1.0E-5 max-iterations 500}}
x
y)
logistic-regression classifier. Backend library: smile
logistic-regression classifier. Backend library: smile
(model-native model)
Return trained model as a backend class.
Return trained model as a backend class.
List of multiclass strategies for svm
List of multiclass strategies for [[svm]]
(naive-bayes x y)
(naive-bayes {:keys [model priori sigma] :or {model :bernoulli sigma 1.0}} x y)
naive-bayes classifier. Backend library: smile
naive-bayes classifier. Backend library: smile
(neural-net x y)
(neural-net {:keys [error-function activation-function layers learning-rate
momentum weight-decay number-of-epochs]
:or {error-function :cross-entropy
learning-rate 0.1
momentum 0.0
weight-decay 0.0
number-of-epochs 25}}
x
y)
neural-net classifier. Backend library: smile
neural-net classifier. Backend library: smile
(predict model v)
(predict model v posteriori?)
Predict categories for given vector. If posteriori?
is true returns also posteriori probability (default false
).
Predict categories for given vector. If `posteriori?` is true returns also posteriori probability (default `false`).
(predict-all model v)
(predict-all model v posteriori?)
Predict categories for given sequence of vectors. If posteriori?
is true returns also posteriori probability (default false
).
Predict categories for given sequence of vectors. If `posteriori?` is true returns also posteriori probability (default `false`).
(qda x y)
(qda {:keys [priori tolerance] :or {priori nil tolerance 1.0E-4}} x y)
qda classifier. Backend library: smile
qda classifier. Backend library: smile
(random-forest x y)
(random-forest {:keys [number-of-trees split-rule mtry node-size max-nodes
subsample]
:or {number-of-trees 500
split-rule :gini
node-size 1
max-nodes 100
subsample 1.0}}
x
y)
random-forest classifier. Backend library: smile
random-forest classifier. Backend library: smile
(rbf-network x y)
(rbf-network {:keys [distance rbf number-of-basis normalize?]
:or {distance dist/euclidean number-of-basis 10 normalize? false}}
x
y)
rbf-network classifier. Backend library: smile
rbf-network classifier. Backend library: smile
(rda x y)
(rda {:keys [alpha priori tolerance] :or {alpha 0.9 tolerance 1.0E-4}} x y)
rda classifier. Backend library: smile
rda classifier. Backend library: smile
List of split rules for [[decision tree]] and random-forest
List of split rules for [[decision tree]] and [[random-forest]]
(svm x y)
(svm {:keys [kernel c-or-cp cn strategy-for-multiclass class-weights tolerance
epochs]
:or {kernel (k/kernel :linear)
c-or-cp 1.0
cn 1.0
strategy-for-multiclass :one-vs-one
tolerance 0.001
epochs 2}}
x
y)
svm classifier. Backend library: smile
svm classifier. Backend library: smile
(train model)
(train model xs ys)
Train another set of data for given classifier or force training already given data.
Train another set of data for given classifier or force training already given data.
(validate model tx ty)
Validate data against trained classifier. Same as [[test]].
Validate data against trained classifier. Same as [[test]].
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close