hell
This commit is contained in:
parent
5790bca330
commit
b27c22fdef
1 changed files with 15 additions and 10 deletions
|
@ -16,6 +16,7 @@
|
|||
$fcount = array();
|
||||
$frs = array();
|
||||
$matrixe = array();
|
||||
$msum_old = 0;
|
||||
|
||||
foreach ($result as $usern) {
|
||||
$fn = $usern['username'];
|
||||
|
@ -34,6 +35,7 @@
|
|||
|
||||
$matrixe[$fn] = array();
|
||||
$matrixe[$fn][$fn] = 1;
|
||||
$msum_old++;
|
||||
}
|
||||
|
||||
$ch = 0;
|
||||
|
@ -52,20 +54,16 @@
|
|||
if ($usern['username'] == $fn) continue;
|
||||
$dst = $fcount[$fn];
|
||||
|
||||
$matrixe[$usern['username']][$fn] = 1 + 1 / ($dst + 10) / 10;
|
||||
|
||||
$msum_old += $matrixe[$usern['username']][$fn] = 1 + 1 / ($dst + 10) / 10;
|
||||
|
||||
///$pr[$usern['username']] += $pr[$fn] / ($dst + 10) / 10;
|
||||
}
|
||||
}
|
||||
|
||||
$msum = 1;
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$prold = $pr;
|
||||
$matrixf = $matrixe;
|
||||
$msum_old = $msum;
|
||||
$msum = 1;
|
||||
$msum = 0;
|
||||
|
||||
$chh = 0;
|
||||
foreach ($result as $usera) {
|
||||
$una = $usera['username'];
|
||||
if (count($frs[$una]) == 0) continue;
|
||||
|
@ -75,7 +73,6 @@
|
|||
if ($prb < pow(1 / 1e6,1 - ($i / 50))) {
|
||||
continue;
|
||||
}
|
||||
$chh += $ch;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +92,7 @@
|
|||
|
||||
foreach ($result as $userc) {
|
||||
$unc = $userc['username'];
|
||||
$matrixe[$una][$unb] += $matrixf[$una][$unc] * $matrixf[$unc][$unb] / $msum_old * $chh;
|
||||
$matrixe[$una][$unb] += $matrixf[$una][$unc] * $matrixf[$unc][$unb];
|
||||
}
|
||||
|
||||
$msum += $matrixe[$una][$unb];
|
||||
|
@ -103,6 +100,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($result as $usera) {
|
||||
$una = $usera['username'];
|
||||
|
||||
foreach ($result as $userb) {
|
||||
$unb = $userb['username'];
|
||||
$matrixe[$una][$unb] *= $msum_old / $msum;
|
||||
}
|
||||
}
|
||||
|
||||
$new_sum = array_sum($pr);
|
||||
foreach ($result as $usern) {
|
||||
$h = $pr[$usern['username']];
|
||||
|
@ -110,7 +116,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$new_sum = array_sum($pr);
|
||||
foreach ($result as $usern) {
|
||||
$pr[$usern['username']] = $pr[$usern['username']] * 100 / $new_sum;
|
||||
|
|
Loading…
Reference in a new issue