私はマルコフクラスタリングアルゴリズムの詳細を以下の例を通じて取り組んできました:マルコフクラスタリングアルゴリズム
http://www.cs.ucsb.edu/~xyan/classes/CS595D-2009winter/MCL_Presentation2.pdf
私は、アルゴリズムを正確に表現しているが、私は同じ結果を得ていないのですように感じますこのガイドは、少なくとも、その入力のためになっていた。
-
:私は多分私はちょうど小さな事実を見逃しているか、これだけのためにどこかに小さな微調整を必要とするが、私はを含むいくつかのバリエーションを試してみましたかどうかわからないのです
http://jsfiddle.net/methodin/CtGJ9/
- が原稿ガイドがそれを必要としなかったので、公式MCLさdが、(正規の取り外し精度に基づいて、等価性チェック
- を膨張/拡張スワップ
:
現在のコードはです
これらのすべてが同じ結果を返しました。ノードはそれ自体にのみ影響します。私もVBで同様のアルゴリズムの実装を見つけた
: http://mcl.codeplex.com/SourceControl/changeset/changes/17748#MCL%2fMCL%2fMatrix.vb
そして、私のコードは、その番号(600 - 例えば距離)を除いて一致しているようです。
これは、拡張機能
// Take the (power)th power of the matrix effectively multiplying it with
// itself pow times
this.matrixExpand = function(matrix, pow) {
var resultMatrix = [];
for(var row=0;row<matrix.length;row++) {
resultMatrix[row] = [];
for(var col=0;col<matrix.length;col++) {
var result = 0;
for(var c=0;c<matrix.length;c++)
result += matrix[row][c] * matrix[c][col];
resultMatrix[row][col] = result;
}
}
return resultMatrix;
};
であり、これはインフレ機能
// Applies a power of X to each item in the matrix
this.matrixInflate = function(matrix, pow) {
for(var row=0;row<matrix.length;row++)
for(var col=0;col<matrix.length;col++)
matrix[row][col] = Math.pow(matrix[row][col], pow);
};
そして最後に、メインパススルー機能行列のクローンを作成するcurrentMatrix.sliceを使用し
// Girvan–Newman algorithm
this.getMarkovCluster = function(power, inflation) {
var lastMatrix = [];
var currentMatrix = this.getAssociatedMatrix();
this.print(currentMatrix);
this.normalize(currentMatrix);
currentMatrix = this.matrixExpand(currentMatrix, power);
this.matrixInflate(currentMatrix, inflation);
this.normalize(currentMatrix);
while(!this.equals(currentMatrix,lastMatrix)) {
lastMatrix = currentMatrix.slice(0);
currentMatrix = this.matrixExpand(currentMatrix, power);
this.matrixInflate(currentMatrix, inflation);
this.normalize(currentMatrix);
}
return currentMatrix;
};
jsfiddleリンクは、あなたの実装がどこかにまだ使用可能である、壊れているように見えますか?ありがとう! – skyork
奇妙な。どこに行ったのだろう? https://gist.github.com/methodin/1573728ここ – methodin
codepenされています:ここでは、コードと要旨はあるhttp://codepen.io/Xeoncross/pen/NqWqWe?editors=101は – Xeoncross