This commit is contained in:
biglyderv 2025-01-28 18:53:38 -05:00
parent 4385494a38
commit 1f7ed5116e

View file

@ -36,11 +36,16 @@
$matrixe[$fn][$fn] = 1; $matrixe[$fn][$fn] = 1;
} }
$ch = 0;
foreach ($result as $usern) { foreach ($result as $usern) {
$theuser = $usern['username']; $theuser = $usern['username'];
$followers = $frs[$theuser]; $followers = $frs[$theuser];
if (count($followers) > 0) {
$ch++;
}
foreach ($followers as $follown) { foreach ($followers as $follown) {
$fn = $follown['target']; $fn = $follown['target'];
@ -60,6 +65,7 @@
$matrixf = $matrixe; $matrixf = $matrixe;
$msum_old = $msum; $msum_old = $msum;
$msum = 1; $msum = 1;
foreach ($result as $usera) { foreach ($result as $usera) {
$una = $usera['username']; $una = $usera['username'];
$pr[$una] = 0.1; $pr[$una] = 0.1;
@ -69,7 +75,7 @@
$matrixe[$una][$unb] = 0; $matrixe[$una][$unb] = 0;
foreach ($result as $userc) { foreach ($result as $userc) {
$unc = $userc['username']; $unc = $userc['username'];
$matrixe[$una][$unb] += 0.3 + $matrixf[$una][$unc] * $matrixf[$unc][$unb] / $msum_old * pow(count($result),3); $matrixe[$una][$unb] += 0.1 + $matrixf[$una][$unc] * $matrixf[$unc][$unb] / $msum_old * pow($ch,3);
} }
$msum += $matrixe[$una][$unb]; $msum += $matrixe[$una][$unb];
$pr[$una] += $prold[$unb] * $matrixe[$una][$unb]; $pr[$una] += $prold[$unb] * $matrixe[$una][$unb];