Skip to content

martinkersner/cl-ml

Repository files navigation

cl-ml

Machine Learning library for Common Lisp

Martin Kersner, m.kersner@gmail.com

cl-ml currently supports following machine learning algorithms:

Requirements

cl-ml requires asdf to be installed. cl-math and cl-plot are included as submodules to cl-ml project.

Get the latest version

git clone --recursive https://github.com/martinkersner/cl-ml.git

Start using cl-ml

(load "init")

Algorithms

Naive Bayes Classifier

Currently, only Multinomial Naive Bayes Classifier is supported.

  1. Create instance of Naive Bayes Classifier
(defparameter *nbc*
  (make-instance 'naive-bayes-classifier))
  1. Pass training data. Training data will be transformed to feature vectors within training procedure.
; X-train represent training data in list of lists format
; y-train represent training labels in cl-math matrix format
(fit *nbc* X-train y-train)
  1. Predict on new data
; X-test represent training data in list of lists format
(predict *nbc* X-test)

Artificial Neural Networks

Currently, only fully connected layers with sigmoid activation function are supported. Optimization is performed using Stochastic Gradient Descent (SGD).

  1. Create network with 2 neurons in input layer, 3 neurons in hidden layer and 1 neuron the output layer.
(defparameter *nn*
  (make-instance 'neural-network :nn-dims '(2 3 1)))
  1. Define training parameters for SGD.
(defparameter *params*
  (generate-params '((num-epoch       50)
                     (lr              0.3)
                     (mini-batch-size 20))))
  1. Start training.
; X-train represent training data in cl-math matrix format
; y-train represent training labels in cl-math matrix format
(fit *nn* X-train y-train *params*)
  1. Predict on new data.
; X-test represent testing data in cl-math matrix format
(predict *nn* X-test)

Project Roadmap

  1. Add new algorithms
    • k-Means
    • Adaboost
    • Autoencoders
    • CNN
  2. Add new default data sets
  3. Methods for data manipulation
    • Generating new data
  4. Methods enabling easier training
    • Cross validation
    • Grid search

About

Machine Learning library for Common Lisp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published