Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jasonsilberman/SwiftNeuralNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsilberman committed Jun 19, 2018
2 parents fd1adf9 + a8a9264 commit f2fefaf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 80 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
4 changes: 0 additions & 4 deletions SwiftNeuralNetwork.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
966DFD2720C465EF00222F0D /* SineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966DFD2620C465EF00222F0D /* SineTests.swift */; };
966DFD2920C4A35B00222F0D /* DataNormalizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966DFD2820C4A35B00222F0D /* DataNormalizer.swift */; };
966DFD2C20C4B61C00222F0D /* DataNormalizerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966DFD2B20C4B61C00222F0D /* DataNormalizerTests.swift */; };
96EC01C620C21072008D3A2F /* SwiftNeuralNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96EC01BC20C21072008D3A2F /* SwiftNeuralNetwork.framework */; };
Expand All @@ -32,7 +31,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
966DFD2620C465EF00222F0D /* SineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SineTests.swift; sourceTree = "<group>"; };
966DFD2820C4A35B00222F0D /* DataNormalizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataNormalizer.swift; sourceTree = "<group>"; };
966DFD2B20C4B61C00222F0D /* DataNormalizerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataNormalizerTests.swift; sourceTree = "<group>"; };
96EC01BC20C21072008D3A2F /* SwiftNeuralNetwork.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftNeuralNetwork.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -90,7 +88,6 @@
isa = PBXGroup;
children = (
96EC01D720C210C7008D3A2F /* XORTests.swift */,
966DFD2620C465EF00222F0D /* SineTests.swift */,
966DFD2B20C4B61C00222F0D /* DataNormalizerTests.swift */,
96EC01D820C210C7008D3A2F /* Info.plist */,
);
Expand Down Expand Up @@ -242,7 +239,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
966DFD2720C465EF00222F0D /* SineTests.swift in Sources */,
966DFD2C20C4B61C00222F0D /* DataNormalizerTests.swift in Sources */,
96EC01D920C210C7008D3A2F /* XORTests.swift in Sources */,
);
Expand Down
76 changes: 0 additions & 76 deletions Tests/SineTests.swift

This file was deleted.

0 comments on commit f2fefaf

Please sign in to comment.