Git Product home page Git Product logo

somnibyte / mlkit Goto Github PK

View Code? Open in Web Editor NEW
152.0 13.0 14.0 3.36 MB

A simple machine learning framework written in Swift ๐Ÿค–

License: MIT License

Swift 82.96% Objective-C 10.05% Shell 2.70% Ruby 0.35% C 3.94%
regression ridge-regression swift machine-learning machine-learning-algorithms artificial-intelligence polynomial-regression linear-regression machine-learning-library mlkit

mlkit's Introduction

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.

mlkit's People

Contributors

niilohlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mlkit's Issues

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!

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.