All Projects → davecom → SwiftSimpleNeuralNetwork

davecom / SwiftSimpleNeuralNetwork

Licence: Apache-2.0 license
A simple multi-layer feed-forward neural network with backpropagation built in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to SwiftSimpleNeuralNetwork

Genann
simple neural network library in ANSI C
Stars: ✭ 1,088 (+3651.72%)
Mutual labels:  backpropagation
Teaching Monolith
Data science teaching materials
Stars: ✭ 126 (+334.48%)
Mutual labels:  backpropagation
Character-recognition-by-neural-network
Back Propagation, Python
Stars: ✭ 32 (+10.34%)
Mutual labels:  backpropagation
Deeplearning
Deep Learning From Scratch
Stars: ✭ 66 (+127.59%)
Mutual labels:  backpropagation
Nn
A tiny neural network 🧠
Stars: ✭ 119 (+310.34%)
Mutual labels:  backpropagation
Backprop
Heterogeneous automatic differentiation ("backpropagation") in Haskell
Stars: ✭ 154 (+431.03%)
Mutual labels:  backpropagation
Mathematics
数学知识点滴积累 矩阵 数值优化 神经网络反向传播 图优化 概率论 随机过程 卡尔曼滤波 粒子滤波 数学函数拟合
Stars: ✭ 417 (+1337.93%)
Mutual labels:  backpropagation
Deep-Learning-Coursera
Projects from the Deep Learning Specialization from deeplearning.ai provided by Coursera
Stars: ✭ 123 (+324.14%)
Mutual labels:  backpropagation
Deeplearning Notes
Notes for Deep Learning Specialization Courses led by Andrew Ng.
Stars: ✭ 126 (+334.48%)
Mutual labels:  backpropagation
ODTbrain
Python library for diffraction tomography with the Born and Rytov approximations
Stars: ✭ 19 (-34.48%)
Mutual labels:  backpropagation
Selfdrivingcar
A collection of all projects pertaining to different layers in the SDC software stack
Stars: ✭ 107 (+268.97%)
Mutual labels:  backpropagation
The Math Behind A Neural Network
📄 The math behind the neural network used for Olivia
Stars: ✭ 119 (+310.34%)
Mutual labels:  backpropagation
Neural Network From Scratch
Ever wondered how to code your Neural Network using NumPy, with no frameworks involved?
Stars: ✭ 230 (+693.1%)
Mutual labels:  backpropagation
Theoretical Proof Of Neural Network Model And Implementation Based On Numpy
This resource implements a deep neural network through Numpy, and is equipped with easy-to-understand theoretical derivation, mainly for the in-depth understanding of neural networks. 神经网络模型的理论证明与基于Numpy的实现。
Stars: ✭ 65 (+124.14%)
Mutual labels:  backpropagation
ai-backpropagation
The backpropagation algorithm explained and demonstrated.
Stars: ✭ 20 (-31.03%)
Mutual labels:  backpropagation
Artificialintelligenceengines
Computer code collated for use with Artificial Intelligence Engines book by JV Stone
Stars: ✭ 35 (+20.69%)
Mutual labels:  backpropagation
Mlkit
A simple machine learning framework written in Swift 🤖
Stars: ✭ 144 (+396.55%)
Mutual labels:  backpropagation
Blur-and-Clear-Classification
Classifying the Blur and Clear Images
Stars: ✭ 88 (+203.45%)
Mutual labels:  backpropagation
NeuroFlow
Awesome deep learning crate
Stars: ✭ 69 (+137.93%)
Mutual labels:  backpropagation
Backpropagation
Implementing multilayer neural networks through backpropagation using Java.
Stars: ✭ 242 (+734.48%)
Mutual labels:  backpropagation

SwiftSimpleNeuralNetwork

A simple multi-layer feed-forward neural network with backpropagation built in Swift.

Philosophy

This teaching project is proclaimed simple for two reasons:

  • The code aims to be simple to understand (even at the expense of performance). I built this project to learn more about implementing neural networks. It does not aim to be state of the art or feature complete, but instead approachable.
  • The type of neural network targetted is very specific - only multi-layer feed-forward backpropagation networks. Why? Because we're keeping it simple,

Contributions to the project will be measured not only by their functional aspects (improved performance, more features) but also by how much they stick to the philosophy.

Installation

The project requires Xcode 10.2 and Swift 5.

Manual

For the present, the best way to try the project out is through the wine and iris Xcode unit tests. Just download or clone the repository and run them from within Xcode.

SPM

You can also install the project's main files (but not the unit tests) through SPM via this repository.

Mac Example App

The example app for macOS that comes with SwiftSimpleNeuralNetwork trains on 60,000 MNIST sample images and then predicts another 10,000 testing images. In my testing it reaches as high as 94% accuracy without much tuning (just many batches of training on the full dataset). This is definitely not state of the art, but for a simple neural network, it's a decent demonstration.

MNIST Example App Screenshot

Unit Tests

A check indicates a test is passing/working.

  • IrisTest.swift uses the classic data set (contained in iris.csv) to classify 150 irises by four attributes.
  • WineTest.swift uses a data set of 178 wines across thirteen attributes (contained in wine.csv) to classify wines by cultivar (three cultivars total). The test trains on the first 150 and then validates itself by classifying the remaining 28.
  • SinTest.swift tries to learn to approximate the sin() function. ~80% of predictions come close to correct values.

Book Chapter

Chapter 7 of Classic Computer Science Problems in Swift is based on this project. It contains it a step-by-step tutorial, explaining how a slightly more primitive version of the project works.

License, Contributions, and Attributions

SwiftSimpleNeuralNetwork is Copyright 2016-2019 David Kopec and licensed under the Apache License 2.0 (see LICENSE). As per the Apache license, contributions are also Apache licensed by default. And contributions are welcome!

The wine and iris datasets in the unit tests are provided curtosy of the UCI Machine Learning Repository which should be cited as:

Lichman, M. (2013). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

The MNIST dataset is from LeCun, Cortes, and Burges.

The overall neural network algorithm implemented throughout the project was derived primarily from Chapter 18 of Artificial Intelligence: A Modern Approach (Third Edition) by Stuart Russell and Peter Norvig.

A few small individual utility functions in Functions.swift are from third party sources and cited appropriately in-source.

Future Directions

  • Improved in-source documentation
  • Improved documentation in this README
  • More unit tests
  • More activation functions
  • Utility function to archive (serialize) and recreate (deserialize) trained neural networks
  • Better testing of networks with more than one hidden layer
  • Improved performance
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].