Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ben-ng/learnkit
High-performance Cocoa framework for Machine Learning on iOS and OS X.
https://github.com/ben-ng/learnkit
Last synced: 21 days ago
JSON representation
High-performance Cocoa framework for Machine Learning on iOS and OS X.
- Host: GitHub
- URL: https://github.com/ben-ng/learnkit
- Owner: ben-ng
- License: mit
- Created: 2014-10-09T21:22:34.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-17T07:17:48.000Z (almost 10 years ago)
- Last Synced: 2024-04-16T01:10:12.928Z (7 months ago)
- Homepage: http://mattrajca.com
- Size: 8.72 MB
- Stars: 0
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
LearnKit
========LearnKit is a Cocoa framework for Machine Learning. It currently runs on top of the Accelerate framework on iOS and OS X.
Supported Algorithms
--------------------- k-Means
- k-Nearest Neighbors
- Linear Regression
- Logistic Regression
- Naive Bayes
- Neural Networks
- Principal Component AnalysisExample
-------In this example, we have a matrix that contains 5000 20x20 digits. Each 20x20 digit has been flattened into a row of 400 pixel intensities. We load it as such:
NSURL *matrixURL = [NSURL fileURLWithPath:matrixPath];
NSURL *matrixOutputURL = [NSURL fileURLWithPath:outputVectorPath];
LNKMatrix *matrix = [[LNKMatrix alloc] initWithBinaryMatrixAtURL:matrixURL
matrixValueType:LNKValueTypeDouble
outputVectorAtURL:matrixOutputURL
outputVectorValueType:LNKValueTypeUInt8
exampleCount:5000
columnCount:400
addingOnesColumn:YES];Next, we set up a conjugate gradient optimization algorithm to train the neural network.
LNKOptimizationAlgorithmCG *algorithm = [[LNKOptimizationAlgorithmCG alloc] init];
algorithm.iterationCount = 400;Now we initialize a neural network classifier with our matrix and optimization algorithm. We also indicate the possible outputs are digits ranging from 1 to 10.
LNKNeuralNetClassifier *classifier = [[LNKNeuralNetClassifier alloc] initWithMatrix:matrix
implementationType:LNKImplementationTypeAccelerate
optimizationAlgorithm:algorithm
classes:[LNKClasses withRange:NSMakeRange(1, 10)]];
classifier.hiddenLayerCount = 1;
classifier.hiddenLayerUnitCount = 25;The neural network parameters above were picked with performance in mind. They can be fine-tuned to increase the accuracy of the classifier. Finally, we train the neural network classifer and predict the class of a previously-unseen digit.
[classifier train];
LNKClass *someDigit = [classifier predictValueForFeatureVector:someImage length:someImageLength];With the right parameters, classification accuracy rates of over 99% can be attained.
Future Tasks
------------- Support collaborative filtering
- Support decision trees
- Support SVMs
- Port to Metal and OpenCLLicense
-------LearnKit is available under the MIT license.
Credits
-------LearnKit uses:
- `fmincg` by Carl Edward Rasmussen
- `liblbfgs`
- Data prepared by Andrew Ng for [Machine Learning](https://www.coursera.org/course/ml)