This is a very simple example of how to implement logistic regression in Swift, using the famous Iris dataset and a conjugate gradient optimizer.
Last updated for Swift 4.2 (Xcode 10.1).
Based on the MATLAB code from Andrew Ng's machine learning course at Coursera.
The included Matrix
class is minimal and unoptimized for performance. For a more complete and accelerated version, see here.
For the fmincg license terms, see the comment in fmincg.swift. There rest of the code is licensed under the terms of the MIT license.