Skip to content

Commit

Permalink
add final documentation for v1
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsilberman authored Jun 16, 2018
1 parent 407b866 commit a8a9264
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ A neural network built in Swift and accelerated by SIMD math. This is a feed for

*This is my first foray into machine learning. It is well tested and being used in production, but please file an issue or create a pull request if you see anything wrong or have any questions.*

## How is this different than CoreML or CreateML?
Both [CoreML](https://developer.apple.com/documentation/coreml) and [CreateML](https://developer.apple.com/documentation/create_ml) are excellent frameworks provided by Apple to assist developers in machine learning. SwiftNeuralNetwork is different than these frameworks however, because SwiftNeuralNetwork is meant to be taught on an iOS device.

## Installation
You can add SwiftNeuralNetwork to your project through [Carthage](https://github.com/Carthage/Carthage) by adding the following to your `Cartfile`.

Expand Down Expand Up @@ -42,6 +45,21 @@ You can calculate the error or cost of the network by using the following functi
let RSS = network.rss(inputs: trainingData, targetOutputs: trainingResults)
```

### Saving a model to disk
Saving a model to disk is useful so you don't have to retrain the model every time you launch the app. With SwiftNeuralNetwork you can do this very easily:

```swift
let encodedData = try JSONEncoder().encode(network)
try storedData.write(to: fileURL)
```

And then you can restore the network later:

```swift
let storedData = try Data(contentsOf: fileURL)
let recreatedNetwork = try JSONDecoder().decode(NeuralNetwork.self, from: storedData)
```

## Activation Functions
The following activation functions are available, although some do not work properly yet. You can see the math for them [here](https://github.com/jasonsilberman/SwiftNeuralNetwork/blob/master/SwiftNeuralNetwork/Sources/ActivationFunction.swift).

Expand Down

0 comments on commit a8a9264

Please sign in to comment.