Skip to content

Instantly share code, notes, and snippets.

View blorsch's full-sized avatar

Beck Lorsch blorsch

View GitHub Profile
@blorsch
blorsch / single_neuron_ann.swift
Last active May 17, 2020 21:47
A single neuron neural network (perceptron) written entirely in Swift with only Foundation
import Foundation
//Swift version of https://github.com/gitshanks/simpleneuralnet/blob/master/neuralnet.py
//In Swift you can't easily add, multiply arrays/matrices etc, so I had write it manually and some of them are kinda ugly
//Used for my 2020 Marin Academy Math Night Presentation: "Neural Networks and Their Applications in Text Generation"
//Pattern to the data: output = column 2 of input
var inputs = [[0,0,1], [1,1,1], [1,0,1], [0,1,1]] as [[Double]]
var outputs = [[0], [1], [0], [1]] as [[Double]]
//
// Complex Number Challenge Part 6, #8
//
// Created by Beck Lorsch on 2/17/20
//
import UIKit
import Foundation
//NOTE: Read in combination with written work for this problem