@@ -133,7 +133,7 @@ class Layer {
133
133
var neurons : [ Neuron ]
134
134
var outputCache : [ Double ]
135
135
136
- init ( previousLayer: Layer ? = nil , numNeurons: Int , activationFunction: @escaping ( Double ) -> Double , derivativeActivationFunction: @escaping ( Double ) -> Double , learningRate: Double ) {
136
+ init ( previousLayer: Layer ? = nil , numNeurons: Int , activationFunction: @escaping ( Double ) -> Double , derivativeActivationFunction: @escaping ( Double ) -> Double , learningRate: Double ) {
137
137
self . previousLayer = previousLayer
138
138
self . neurons = Array < Neuron > ( )
139
139
for _ in 0 ..< numNeurons {
@@ -222,7 +222,7 @@ class Network {
222
222
/// train() uses the results of outputs() run over
223
223
/// many *inputs* and compared against *expecteds* to feed
224
224
/// backpropagate() and updateWeights()
225
- func train( inputs: [ [ Double ] ] , expecteds: [ [ Double ] ] , printError: Bool = false , threshold: Double ? = nil ) {
225
+ func train( inputs: [ [ Double ] ] , expecteds: [ [ Double ] ] , printError: Bool = false , threshold: Double ? = nil ) {
226
226
for (location, xs) in inputs. enumerated ( ) {
227
227
let ys = expecteds [ location]
228
228
let outs = outputs ( input: xs)
@@ -358,7 +358,7 @@ func parseWineCSV() -> (parameters: [[Double]], classifications: [[Double]], spe
358
358
359
359
let ( wineParameters, wineClassifications, wineSpecies) = parseWineCSV ( )
360
360
361
- let wineNetwork : Network = Network ( layerStructure: [ 13 , 7 , 3 ] , learningRate: 0.9 )
361
+ let wineNetwork : Network = Network ( layerStructure: [ 13 , 7 , 3 ] , learningRate: 0.9 )
362
362
363
363
func wineInterpretOutput( output: [ Double ] ) -> Int {
364
364
if output. max ( ) ! == output [ 0 ] {
0 commit comments