Select Page
Latest 1.4 https://github.com/Kalvar/ios-KRFuzzyCMeans-Algorithm MIT ios 7.0, requires ARC Foundation Kalvar Lin

ios-KRFuzzyCMeans-Algorithm

KRFuzzyCMeans has implemented Fuzzy C-Means (FCM) the fuzzy (ファジー理論) clustering / classification algorithm (クラスタリング分類) on Machine Learning (マシンラーニング). It could be used in data mining (データマイニング) and image compression (画像圧縮). If you wanna know how to use and the details, you could contact me via email.

Podfile

``````platform :ios, '7.0'
pod "KRFuzzyCMeans", "~> 1.4"``````

How to use

Import

``#import "KRFuzzyCMeans.h"``
Distance Methods
``````KRFuzzyCMeansDistanceFormulaEuclidean
KRFuzzyCMeansDistanceFormulaCosine
KRFuzzyCMeansDistanceFormulaRBF``````

Training

``````KRFuzzyCMeans *_krFcm   = [KRFuzzyCMeans sharedFCM];
_krFcm.doneThenSave     = YES;
_krFcm.m                = 3;
_krFcm.convergenceError = 0.001f;
_krFcm.distanceFormula  = KRFuzzyCMeansDistanceFormulaEuclidean; //KRFuzzyCMeansDistanceFormulaCosine
[_krFcm addCenters:@[@5.0f, @5.0f]];     //The center 1, cluster 1 start in here
[_krFcm addCenters:@[@10.0f, @10.0f]];   //The center 2, cluster 2 start in here
[_krFcm addCenters:@[@12.0f, @14.0f]];   //The center 3, cluster 3 start in here
[_krFcm addPatterns:@[@[@2, @12], @[@4, @9], @[@7, @13], @[@11, @5], @[@12, @7], @[@14, @4]]];

[_krFcm clusterWithCompletion:^(BOOL success, NSArray *clusters, NSArray *centrals, NSInteger totalTimes)
{
NSLog(@"nn===============================================nn");
NSLog(@"totalTimes : %li", totalTimes);
NSLog(@"results : %@", clusters);
NSLog(@"centrals : %@", centrals);
NSLog(@"nn===============================================nn");

//Directly verify and classify others pattern without continually training the centers, you could use :
[_krFcm directClusterPatterns:@[@[@2, @3], @[@3, @3], @[@5, @9]]];
[_krFcm printResults];

//If you have one or more patterns need to do standard classification, use this to renew all groups and re-adjust the central groups :
[_krFcm addPatterns:@[@[@2, @3], @[@3, @3], @[@5, @9]]];
[_krFcm clusterWithCompletion:^(BOOL success, NSArray *clusters, NSArray *centrals, NSInteger totalTimes)
{
[_krFcm printResults];
}];

} perIteration:^(NSInteger times, NSArray *clusters, NSArray *centrals)
{
NSLog(@"times : %li", times);
NSLog(@"clusters : %@", clusters);
NSLog(@"centrals : %@", centrals);
}];``````

Recalling Tranined Centers

``````// Recalling tranined centers that last saved.
[_krFcm recallCenters];
// Then, start to train or directly cluster the patterns.
[_krFcm directClusterPatterns:@[@[@1, @5], @[@4, @2], @[@7, @3]]];``````

Version

V1.4

MIT.

Latest podspec

```{
"name": "KRFuzzyCMeans",
"version": "1.4",
"summary": "Fuzzy C-Means is clustering algorithm combined fuzzy theory on Machine Learning.",
"description": "KRFuzzyCMeans has implemented Fuzzy C-Means (FCM) the fuzzy (u30d5u30a1u30b8u30fcu7406u8ad6) clustering / classification algorithm (u30afu30e9u30b9u30bfu30eau30f3u30b0u5206u985e) in Machine Learning (u30deu30b7u30f3u30e9u30fcu30cbu30f3u30b0). It could be used in data mining (u30c7u30fcu30bfu30deu30a4u30cbu30f3u30b0) and image compression (u753bu50cfu5727u7e2e).",
"homepage": "https://github.com/Kalvar/ios-KRFuzzyCMeans-Algorithm",
"type": "MIT",
},
"authors": {
"Kalvar Lin": "[email protected]"
},
"source": {
"git": "https://github.com/Kalvar/ios-KRFuzzyCMeans-Algorithm.git",
"tag": "1.4"
},
"platforms": {
"ios": "7.0"
},
"requires_arc": true,