Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
profileview
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Edoardo SARTI
profileview
Commits
c3e61ba4
Commit
c3e61ba4
authored
Apr 25, 2022
by
Edoardo Sarti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
27a3d69a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
38 deletions
+34
-38
mesureHistoramme.ipynb
tree_similarity/mesureHistoramme.ipynb
+34
-38
No files found.
tree_similarity/mesureHistoramme.ipynb
View file @
c3e61ba4
...
...
@@ -212,7 +212,7 @@
},
{
"cell_type": "code",
"execution_count":
3
6,
"execution_count": 6,
"metadata": {},
"outputs": [
{
...
...
@@ -226,37 +226,37 @@
"noise 0.000000 True\n",
"Permutable 0.000000 True\n",
"non-proportional increment 0.000000 True\n",
"Random big numbers or zero 0.02
5459
False\n",
"Random big numbers or zero 0.02
4565
False\n",
"max unbalance 0.146087 False\n",
"proportional increment 0.000000 True\n",
"\n",
"\n",
"--- Incremental noise on signal ---\n",
"0 0.000000 +/- 0.000000\n",
"1 0.000
185 +/- 0.000440
\n",
"2 0.001
894 +/- 0.00228
2\n",
"3 0.005
138 +/- 0.004323
\n",
"4 0.0
10559 +/- 0.007702
\n",
"5 0.01
2664 +/- 0.00756
1\n",
"6 0.01
5651 +/- 0.012095
\n",
"7 0.020
212 +/- 0.013827
\n",
"8 0.02
6308 +/- 0.020254
\n",
"9 0.02
9255 +/- 0.024522
\n",
"10 0.03
1770 +/- 0.023523
\n",
"1 0.000
219 +/- 0.000476
\n",
"2 0.001
619 +/- 0.00185
2\n",
"3 0.005
863 +/- 0.004867
\n",
"4 0.0
08322 +/- 0.005766
\n",
"5 0.01
3591 +/- 0.00854
1\n",
"6 0.01
7515 +/- 0.012170
\n",
"7 0.020
925 +/- 0.014721
\n",
"8 0.02
4099 +/- 0.019659
\n",
"9 0.02
4999 +/- 0.019011
\n",
"10 0.03
2244 +/- 0.024834
\n",
"\n",
"\n",
"--- Incremental random noise ---\n",
"0 0.000138 +/- 0.000000\n",
"1 0.025
829 +/- 0.01890
6\n",
"2 0.0
33744 +/- 0.0252
67\n",
"3 0.0
28168 +/- 0.0229
69\n",
"4 0.02
8078 +/- 0.024013
\n",
"5 0.02
9980 +/- 0.025617
\n",
"6 0.02
8973 +/- 0.021527
\n",
"7 0.0
28279 +/- 0.019776
\n",
"8 0.02
8193 +/- 0.024633
\n",
"9 0.02
9332 +/- 0.024630
\n",
"10 0.02
5569 +/- 0.022864
\n",
"1 0.025
660 +/- 0.01946
6\n",
"2 0.0
27256 +/- 0.0229
67\n",
"3 0.0
30341 +/- 0.0245
69\n",
"4 0.02
7788 +/- 0.019176
\n",
"5 0.02
3954 +/- 0.018645
\n",
"6 0.02
5143 +/- 0.021361
\n",
"7 0.0
30559 +/- 0.023147
\n",
"8 0.02
5742 +/- 0.017046
\n",
"9 0.02
6679 +/- 0.021437
\n",
"10 0.02
6494 +/- 0.023600
\n",
"\n",
"\n",
"--- Incremental unbalanced distribution ---\n",
...
...
@@ -339,6 +339,7 @@
" am = np.argmax([pears(h,h2) for h in ps])\n",
" return am, ps[am], pears(ps[am],h2)\n",
"\n",
"\"\"\"\n",
"def probhist(hh1, hh2):\n",
" #pseudocounts\n",
" h1 = [x+1 for x in hh1]\n",
...
...
@@ -359,6 +360,7 @@
" res += rat*math.log((rat/ratsort), 2)\n",
" return res\n",
"\n",
"\n",
"def probhist(hh1, hh2, symm=True):\n",
" #Pseudocounts\n",
" eps = 0.00001\n",
...
...
@@ -390,33 +392,27 @@
" return res/2\n",
"\n",
" return res\n",
"\"\"\"\n",
"\n",
"\n",
"def probhist(hh1, hh2, symm=True):\n",
" def likelihood(doubleh, d):\n",
" diffs = np.zeros(len(doubleh)+1)\n",
" for i in range(len(doubleh)):\n",
" diffs[i] = abs(doubleh[i][0]-doubleh[i][1])\n",
" diffs[-1] = 10\n",
" return sum(diffs >= d)/(len(diffs))\n",
" \n",
" #NO Pseudocounts\n",
"def probhist(hh1, hh2, symm=True): \n",
" # Pseudocounts\n",
" eps = 0.00001\n",
" h1 = [x+(max(hh1)-min(hh1)+eps)/100 for x in hh1]\n",
" h2 = [x+(max(hh2)-min(hh2)+eps)/100 for x in hh2]\n",
" \n",
" #Normalize histos\n",
" #
Normalize histos\n",
" s1, s2 = sum(h1), sum(h2)\n",
" nh1, nh2 = [x/s1 for x in h1], [x/s2 for x in h2]\n",
" \n",
" #Couple histos and sort second\n",
" #
Couple histos and sort second\n",
" twonhs = list(zip(nh1,nh2))\n",
" twonhs = sorted(twonhs, key= lambda x:x[1])\n",
" \n",
" #Sort both histos and then couple\n",
" #
Sort both histos and then couple\n",
" twosortednhs = list(zip(sorted(nh1), sorted(nh2)))\n",
" \n",
" # SUM P1/P2 log2(P1/P1') = SUM P1/P2 log2((P1/P2) / (P1'/P2')) because P2 = P2'\n",
" # Cross-mutual information\n",
" # SUM f(h1,h2) log2 (f(h1,h2) / f(h1',h2')) with h2 = h2'\n",
" res = 0\n",
" for i in range(len(h1)):\n",
" d = stable_sigmoid(abs(twonhs[i][0]-twonhs[i][1])-0.5)\n",
...
...
@@ -426,8 +422,7 @@
" return res\n",
"\n",
"\n",
"\n",
"\n",
"\"\"\"\n",
"def probhist2(hh1, hh2):\n",
" def likelihood(doubleh, d):\n",
" diffs = np.zeros(len(doubleh)+1)\n",
...
...
@@ -451,6 +446,7 @@
" for i in range(len(h1)):\n",
" res += likelihood(twosortednhs, twonhs[i][0]-twonhs[i][1])*math.log(likelihood(twosortednhs, twonhs[i][0]-twonhs[i][1]), 2)\n",
" return res\n",
"\"\"\"\n",
"\n",
"def agg_probhist(h1, h2):\n",
" return probhist(agg_vector(h1), agg_vector(h2))\n",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment