Giter Site home page Giter Site logo

netz's Introduction

Netz - Clojure Neural Network Library

Description

Netz is a Clojure implementation of a multilayer perceptron (MLP), a type of feedforward artificial neural network. Netz provides functions for training and running MLPs. Training is accomplished via gradient descent batch Rprop or standard backpropagation.

Netz implements Rprop as described by Riedmiller in Rprop - Description and Implementation Details. A description of Netz's standard backpropagation algorithm can be found in docs/backpropagation.pdf.

Netz uses Incanter for matrix operations.

WARNING: Netz has had very little real world testing and training convergence is still slower than more sophisticated implementations. For production ready implementations, try:

  • FANN (C, Java, Ruby, Python and many more...)
  • Neuroph (Java)
  • Encog (Java and CLR)

Usage

(ns your-namespace
  (:require [netz.core :as netz]))

(def examples [[[0 0] [1]]
               [[0 1] [0]]
               [[1 0] [0]]
               [[1 1] [1]]])

(def network (netz/train examples {:hidden-neurons [2]}))

(netz/run network [0 0]) ; => [0.9176]
(netz/run network [0 1]) ; => [0.0549]
(netz/run network [1 0]) ; => [0.0728]
(netz/run network [1 1]) ; => [0.9307]

Options

  • :hidden-neurons - A vector containing the number of neurons in each hidden layer. Set to [2 2] for two hidden layers with two neurons each, or [] for no hidden layers. Setting this option is recommended. Default: One hidden layer with the same number of hidden neurons as inputs.

  • :learning-algorithm - The algorithm to use while training. Choose either :rprop for the Rprop algorithm or :bprop for standard back propagation. Default: :rprop.

  • :bprop

    • :learning-rate - The learning rate used while training with the standard backpropagation algorithm. Default: 0.25.
    • :learning-momentum - The learning momentum used while training with the standard backpropagation algorithm. Default: 0.0.
  • :rprop

    • :init-update - Initial update value used for Rprop. Default: 0.1.
    • :update-min - Minimum update value used for Rprop. Default: 1e-6.
    • :update-max - Maximum update value used for Rprop. Default: 50.0.
    • :increase-factor - Increase factor for Rprop. Default: 1.2.
    • :decrease-factor - Decrease factor for Rprop. Default: 0.5.
  • :regularization-constant - The regularization constant (lambda) used to penalize large weights. Default: 0.0.

  • :callback - A callback function. If provided, Netz will call this function after every epoch of training. Returning false or nil from this callback will cause training to stop. See netz.core/report-callback for an example. Default: netz.core/report-callback.

  • :callback-resolution - An integer specifying how often the callback function is invoked. Default: 100.

  • :max-epochs - An integer specifying the maximum number of training epochs. Default: 20,000.

  • :desired-error - A float specifying the desired training set mean squared error (MSE) used while training. Training will stop once the MSE drops below the desired error. Default: 0.005

  • :calc-batch-error-in-parallel - Calculate example batch errors in parallel for each epoch. Default: true.

  • :weight-initialization

    • :method - The weight initialization method. Choose either :random for randomly initialized weights or :nguyen-widrow to use the Nguyen-Widrow initialization method. Default: :nguyen-widrow.
    • :range - Randomly initialized weights will be between [-:weight-initialization-range .. :weight-initialization-range]. Default: 0.5.

License and Copyright

Netz is distributed under the MIT License. See LICENSE.

Copyright © 2012 Nick Ewing

netz's People

Contributors

nickewing avatar

Stargazers

David.Gao avatar  Bayern Munich avatar Graham Fetterman avatar iomonad avatar Sungjin Chun avatar  avatar Ronen avatar Joseph Wilk avatar Oleg Seryh avatar Daniel A. Matysiak avatar  avatar roop small avatar Hady Mahmoud avatar MISUMI Masaru avatar Srđan Panić avatar Steffen Dienst avatar Adrian Rosian avatar David Petrovics avatar Vijay Kiran avatar jirkapenzes avatar Vasiliy Yorkin avatar Aistis Raulinaitis avatar hamlet avatar Shaun Robinson avatar Michael Rubanov avatar Christopher Thomas Davies avatar Honza Pokorný avatar Zeno Zeng avatar Lars Trieloff avatar  avatar Daniel Cestari avatar  avatar Halo Master avatar Vikrant Sagar avatar Blake Jakopovic avatar Akhil Wali avatar Liangjie Xia avatar SAWADA Takahiro / Gugen Koubou LLC avatar  avatar Shaun Gilchrist avatar Amy Unger avatar Leonid Beschasny avatar Maksim Soltan avatar Erik Erwitt avatar John Downs avatar Jon Rose avatar Priyatam Mudi avatar Nils Wloka avatar Tai avatar Artem Shakhov avatar Claudia Doppioslash avatar Anderson de Andrade avatar Brad Pillow avatar  avatar Gal Dolber avatar Josh Guo avatar John Toohey avatar Bjarte Johansen avatar Mairbek Khadikov avatar Andrés Gu avatar Paul Lam avatar Moran Cohen avatar Justin Tirrell avatar Joshua Stauter avatar Erick Santana avatar Masakazu Ishibashi avatar Ning Sun avatar Dennis Crenshaw avatar David Santiago avatar James Cunningham avatar Matt Smith avatar Sunil S Nandihalli avatar Dmitri Sotnikov avatar Zefira Shannon avatar Kurt Harriger avatar Scott Douglas-Watson avatar Nils Grünwald avatar  avatar J. McConnell avatar  avatar Alex Ott avatar Jenan Wise avatar Devin Walters avatar

Watchers

Halo Master avatar  avatar  avatar hamlet avatar James Cloos avatar  avatar

netz's Issues

Incanter is slow...

Hi I played with matrix libraries for sometimes and Incanter is the slowest.
I obtained better result wrapping directly Jblas with an increment of performance about 20~50 times.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.