04: Fix desired mass function

This commit is contained in:
2022-10-03 12:59:06 +02:00
parent 496f838611
commit 5152fbfc31

View File

@ -393,18 +393,10 @@
" assert x != y\n", " assert x != y\n",
" \n", " \n",
" Q = transition_matrix_Q(graph)\n", " Q = transition_matrix_Q(graph)\n",
" # TODO: What should pi be?\n", " n = graph.number_of_nodes()\n",
" # As we have no preference, we'll take pi to be constant for all values.\n", " # We want to sample a uniform mass distribution pi:\n",
" pi = np.ones(graph.number_of_nodes())\n", " pi = np.ones(n)/n\n",
" #pi = stationary_distributions(Q)[0]\n",
" \n", " \n",
" #return np.min(1, pi[y - 1]*Q[x - 1, y - 1]/(pi[x - 1]*Q[y - 1, x - 1]))\n",
" #print(Q[x - 1, y - 1], Q[y - 1, x - 1], Q[x - 1, y - 1]/Q[y - 1, x - 1])\n",
" #A = Q[x-1, y-1]/Q[y-1, x-1]\n",
" #A = Q[y-1, x-1]/Q[x-1, y-1]\n",
" #A = pi[y - 1]*Q[x - 1, y - 1]/( pi[x - 1]*Q[y - 1, x - 1] )\n",
" #A = Q[x, y]/Q[y, x]\n",
" #print(\"<<<\", A, Q, \">>>\")\n",
" if Q[x, y] == 0:\n", " if Q[x, y] == 0:\n",
" return 0\n", " return 0\n",
" else:\n", " else:\n",