MLKit is a simple machine learning framework written in Swift.

Overview

MLKit (a.k.a Machine Learning Kit) 🤖

MLKit is a simple machine learning framework written in Swift. Currently MLKit features machine learning algorithms that deal with the topic of regression, but the framework will expand over time with topics such as classification, clustering, recommender systems, and deep learning. The vision and goal of this framework is to provide developers with a toolkit to create products that can learn from data. MLKit is a side project of mine in order to make it easier for developers to implement machine learning algorithms on the go, and to familiarlize myself with machine learning concepts.

This project is under active development and is not ready for use in commercial or personal projects.

Awesome Version License Platform

MachineLearningKit Reference

Requirements

Installation

Cocoapods

Add pod 'MachineLearningKit to your PodFile and then run pod install.

Without Cocoapods

  1. Download the repository.
  2. cd [Project_Path_Goes_Here]/Example
  3. pod install

Contributing

The mission of this project is to give developers the ability to incorporate Machine Learning algorithms into their projects with ease and to enable the creation of advanced projects using the Swift programing language. With this being said, I encourage all developers interested in making Machine Learning accessible to the anyone who works with iOS apps and TVOS apps to contribute to this project.

To contribute an algorithm not currently available within the framework, please create an issue and state what algorithm you have implemented. Make sure that there are unit tests involved where applicable. Also, provide a brief overview of how to use your algorithm. You are also welcome to impelment algorithms within the Roadmap section (below).

To contribute to an already existant algorithm within the framework, please create an issue and state any changes or additions you have made.


Wiki

Example Project

⚠️ ️ The Flappy Bird Example Project is located in the Example folder. When you run the example you will see the fitness and the decisions that each Flappy Bird is making. The example project has comments to help with understanding how it was made.


Roadmap:

  • KMeans++ Implementation
  • KMeans Clustering Documentation
  • Neural Network Documentation
  • Logistic Regression
  • Decision Trees

Future Releases:

  • Convolutional Neural Network
  • Recurrent Neural Network
  • Artificial Neural Network using Metal
  • Game Playing AI (MiniMax, Alpha-Beta Pruning)
  • Self Organizing Maps

Features (So Far)

  • Matrix and Vector Operations (uses Upsurge framework)
  • Simple Linear Regression (Allows for 1 feature set)
  • Polynomial Regression (Allows for multiple features)
  • Ridge Regression
  • Multi-Layer Feed Forward Neural Network
  • K-Means Clustering
  • Genetic Algorithms
  • Allows for splitting your data into training, validation, and test sets.
  • K-Fold Cross Validation & Ability to test various L2 penalties for Ridge Regression
  • Single Layer Perceptron, Multi-Layer Perceptron, & Adaline ANN Architectures

Frameworks that MLKit uses

  • 🙌 Upsurge (Matrix and Vector Operations)
  • 🙌 CSVReader (CSV Reading) (Used in Unit Testing)

Development Schedule

Week of August 28th

TBD

License

MIT License

Copyright (c) 2017 Guled Ahmed

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
This repo contains beginner examples to advanced in swift. Aim to create this for learning native iOS development.

iOS-learning-with-swift-22 This repo contains beginner examples to advanced in swift. Aim to create this for learning native iOS development. Oh, you

Scutil - The swift version of my ASOC scutilUtil application. An interesting learning excercise

scutil this is the swift version of my ASOC "scutilUtil" application. An interes

On-device wake word detection powered by deep learning.
On-device wake word detection powered by deep learning.

Porcupine Made in Vancouver, Canada by Picovoice Porcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening

DL4S provides a high-level API for many accelerated operations common in neural networks and deep learning.
DL4S provides a high-level API for many accelerated operations common in neural networks and deep learning.

DL4S provides a high-level API for many accelerated operations common in neural networks and deep learning. It furthermore has automatic differentiati

Automatic spoken language identification (LID) using deep learning.

iLID Automatic spoken language identification (LID) using deep learning. Motivation We wanted to classify the spoken language within audio files, a pr

Conjugar is an app for learning Spanish verb conjugations.
Conjugar is an app for learning Spanish verb conjugations.

Introduction Conjugar is an iPhone™ app for learning Spanish verb conjugations. Conjugar conjugates most Spanish verbs, regular and irregular, in all

BrainCore is a simple but fast neural network framework written in Swift.

BrainCore is a simple but fast neural network framework written in Swift. It uses Metal which makes it screamin' fast. If you want to see it

A toolbox of AI modules written in Swift:  Graphs/Trees, Support Vector Machines, Neural Networks, PCA, K-Means, Genetic Algorithms
A toolbox of AI modules written in Swift: Graphs/Trees, Support Vector Machines, Neural Networks, PCA, K-Means, Genetic Algorithms

AIToolbox A toolbox of AI modules written in Swift: Graphs/Trees, Linear Regression, Support Vector Machines, Neural Networks, PCA, KMeans, Genetic Al

A framework for building fast genetic algorithms in Swift.
A framework for building fast genetic algorithms in Swift.

Revolver is a framework for building fast genetic algorithms in Swift 3.0. Features Chromosomes: strings, trees Genetic operators: reproduction, mutat

Comments
  • What should initial weights be?

    What should initial weights be?

    I left the initial weights as the default values but it doesn't set the weights after that

            let initial_weights = Matrix<Float>(rows: 3, columns: 1, elements: [-100000.0, 1.0, 1.0])
    
            let weights = try! polynomialModel.train([timestamp,weekday], output: output_data, initialWeights: initial_weights, stepSize: Float(4e-12), tolerance: Float(1e9))
    

    I've got 2 features like the Polynomial Regression Usage guide.

    opened by junaidxabd 0
  • Kellyroach/swift4

    Kellyroach/swift4

    This pull request updates pods and code in the MLKit repo to Xcode 9.4.1 / Swift 4.2 . Currently, there are a number of yellow and red compiler issues with the MLKit-Example as checked out. E.g.:

    • Converstion to Swift 4 is available
    • Update to recommended settings
    • error: generic parameter 'ML' is not used in function signature
    • warning: redundant conformance constraint 'Self': 'Hashable'
    • error: 'Sequence' requires the types 'Span.Element' (aka 'CountableClosedRange') and '[Int]' be equivalent

    Our pull request fixes these compilation issues with MLKit-Example . We've also added an AppIcon and LaunchImage to the demo app.

    opened by kellyroach 0
  • Carthage support

    Carthage support

    opened by TofPlay 1
  • restructuring of ANN for flexibility and performance gains

    restructuring of ANN for flexibility and performance gains

    First off, what you are working on here is immensely impressive. I just wanted to point out somethings I have learned implementing NN's myself and pass along any possible insight.

    If I understand the structure currently, you have an overarching NN class that contains references to a layer class which itself contains references to your final neurons. A possible simplification you may want to look into is to completely eliminate the neurons class and rather represent each layer in the network as a single 2D vector/tensor with dimension mxn where m is the number of neurons in the layer and n is the number of neurons in the previous layer. With this approach you can calculate forward propagation at each layer by taking said layers mxn vector/tensor and dotting it with the previous layers output vector/tensor, resulting in an output vector/tensor that can either be used to feed into the next layer or be used as the output of the network as a whole.

    So while this approach simplifies your forward propagation, it also simplifies your back propagation as you can use the same dot product to go back through your layers and calculate the amount by which you should adjust the weights. If you have a layers input vector, it's output error as a vector, and a vector containing the derivative of the activation function at each output, the amount each weight should be adjusted is the dot product of the input vector and (output error vector * derivative value error). Hopefully I explained that well enough, apologizes if not :(

    You have eluded to a desire to implement some performance increases using Metal down the road and I feel you may also find dot products are ideal for parallelization on a GPU.

    Any who, feel free to ignore this but I just wanted to pass it along. Excited to see where this project ends up!

    enhancement 
    opened by beeedy 5
Releases(0.1.8)
  • 0.1.8(Apr 20, 2017)

    The Neural Network class has been revised to support matrix and vector operations which leverages the Upsurge library. Tutorials on the new Neural Network code are comings soon.

    Source code(tar.gz)
    Source code(zip)
  • 0.1.6(Mar 10, 2017)

    • Genome class has been turned into a protocol. This way you can create structs that conform to the protocol which conversely reduces the amount of memory you use if this were a class.
    • Flappy Bird Game has been slightly adjusted (AI was able to get a score of 2 in 30 min 🎉 results may vary)
    • More Documentation available
    Source code(tar.gz)
    Source code(zip)
  • 0.1.5(Mar 9, 2017)

Owner
Guled
Mobile Developer, Front-End Developer, Appreneur, Aspiring Entrepreneur, Machine Learning Practitioner
Guled
Slot-machine - SwiftUI - iOS App Slot Machine game

Slot Machine SwiftUI Masterclass project iPhone, iPad and Mac (with Catalyst framework) Complex interface Extensions and custom View Modifiers Input t

Arthur Neves 1 Sep 12, 2022
The Swift machine learning library.

Swift AI is a high-performance deep learning library written entirely in Swift. We currently offer support for all Apple platforms, with Linux support

Swift AI 5.9k Jan 2, 2023
Artificial intelligence/machine learning data structures and Swift algorithms for future iOS development. bayes theorem, neural networks, and more AI.

Swift Brain The first neural network / machine learning library written in Swift. This is a project for AI algorithms in Swift for iOS and OS X develo

Vishal 331 Oct 14, 2022
Generate sniglets with machine learning

Give Me A Sniglet! Give Me a Sniglet is a random word-like generator with an on-device machine learning model that validates whether the word is likel

Marquis Kurt 4 Mar 3, 2022
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.

English | 简体中文 | 繁體中文 | 한국어 State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow ?? Transformers provides thousands of pretrained models

Hugging Face 77.1k Dec 31, 2022
Mobile-ios-ml - SBB Mobile Machine Learning for iOS devices

ESTA library: Machine Learning for iOS This framework simplifies the integration

Swiss Federal Railways (SBB) 9 Jul 16, 2022
This is an open-source project for the aesthetic evaluation of images based on the deep learning-caffe framework, which we completed in the Victory team of Besti.

This is an open-source project for the aesthetic evaluation of images based on the deep learning-caffe framework, which we completed in the Victory team of Besti.

The Victory Group of Besti 102 Dec 15, 2022
A simple deep learning library for estimating a set of tags and extracting semantic feature vectors from given illustrations.

Illustration2Vec illustration2vec (i2v) is a simple library for estimating a set of tags and extracting semantic feature vectors from given illustrati

Masaki Saito 661 Dec 12, 2022
British Machine Vision Conference (BMVC)

Introduction This repository contains the model files, solver definitions, and learned weights for the networks described in the following publication

Scott Workman 34 Sep 6, 2022
A Swift deep learning library with Accelerate and Metal support.

Serrano Aiming to offering popular and cutting edge techs in deep learning area on iOS devices, Serrano is developed as a tool for developers & resear

pcpLiu 51 Nov 17, 2022