Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

esafak/niML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

niML

niML is eventually going to be a machine learning library for nimrod. Currently it only provides numerical optimization functionality.

Example

Let's find the minimum of the function y(x) = (x-x_0)^2 for x_0 = (2,1) using gradient descent and Newton's method. For this we will have to pass the gradient and Hessian of the function.

import niml.opt, niml.vec

echo opt.gd(proc(x: array[2, float]) : auto = 2*(x-[2.0, 1.0]), [1.0, 0.0])
echo opt.nm(proc(x: array[2, float]) : auto = 2*(x-[2.0, 1.0]), 
  proc(x: array[2, float]) : auto = array([2.0, 2.0]), [1.0, 0.0])

The result is

[ 1.9999976054757174e+00, 9.9999760547571737e-01]
[ 2.0000000000000000e+00, 1.0000000000000000e+00]

To do/roadmap

There's obviously a lot to do, and you can help.

  • Comment the code.
  • Write unit tests.
  • Create a package.
  • File bug reports.
  • Write ML routines.
  • Add multi-threading.
  • Integrate PLASMA/MAGMA.

License

This software is released under the GNU GPL v2.0 license.

About

Machine learning in nim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages