Skip to content

almost-free/HRLAlgorithms

 
 

Repository files navigation

HRLAlgorithms

CI Status codecov.io Version Docs

Wrapper around LearnKit to easy its integration in Swift CocoaPods.

Installation

HRLAlgorithms is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "HRLAlgorithms"

Usage

#import "HRLMatrix.h"
#import "HRLMatrixSplitter.h"
#import "HRLSplittedMatrix.h"
#import "HRLTrainedKNNClassifier.h"
#import "HRLTrainedKNNClassifierFactory.h"
#import "HRLVector.h"

id<HRLMatrix> matrix = ...;

id<HRLMatrixSplitter> splitter = [[HRLMatrixSplitter alloc] init];
HRLSplittedMatrix *splittedMatrix = [splitter splittedMatrixWithMatrix:matrix
                                                          trainingBias:0.75f];

id<HRLTrainedKNNClassifierFactory> factory = [[HRLTrainedKNNClassifierFactory alloc] init];
id<HRLTrainedKNNClassifier> classifier = [factory makeTrainedKNNClassifierWithMatrix:splittedMatrix.trainingMatrix
                                                                      neighborsCount:5];

NSLog(@"Accuracy: %f", [classifier estimatedAccuracyWithMatrix:splittedMatrix.testMatrix]);

id<HRLVector> vector = ...;

NSLog(@"Predicted class: %lu", (unsigned long)[classifier predictedClassForVector:vector]);

License

HRLAlgorithms is available under the MIT license. See the LICENSE file for more info.

About

(DEPRECATED) Wrapper around LearnKit

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 90.6%
  • Ruby 8.5%
  • C 0.9%