Simply shape

  • View
    5.976

  • Download
    3

Embed Size (px)

DESCRIPTION

幻のプレゼン その1。どこかで発表しようかと思って整理していた研究。もう、自分の中では、終わってしまったので公開してしまおう。ほとんど、研究ノートなので、英語が「滅茶苦茶」なのはご愛嬌。まぁ、数年前のだし...修正するのも面倒。一応、[CC BY]で。

Text of Simply shape

  • 1. Simply ShapesThis is a simply memo

2. Classical shape analysis methodsCircularity:Irregularity: The degree of circularity is how much thisMeasurement of the irregu- larity of a solid. Itpolygon is similar to a circle. Where 1 is a is calculated based on its perimeter and theperfect circle and 0.492 is an isosceles perimeter of the sur- rounding circle. Thetriangle.minimum irregularity is a circle, corresponding at the value 1. A square is the maximum 4p ss: object areairregularity with a value of 1.402.C=p2 p: object perimeterpc I=Quadrature:pThe degree of quadrature of a solid,where 1 is a square and 0.800 an isosceles Elongation:triangle.The degree of ellipticity of a solid, where a circle and a square are the less elliptic shape.pQ=D 4 s E=d D: maximum diameter within an object d: minimum diameter perpendicular at D 3. The Workflow of Morphometric Analysis for Shape Original Shape Distance Matrix (Polygon) Fourier TransformTest the number of ClusteringInverse Fourier Transform Clustering by PAMApproximate ShapeAssign Class info to each object(Polygon) Procrustes AnalysisVisualize on Geo-space 4. Fourier descriptors of closed polygonsFourier transform enables to represent any periodic function with indefinite summation oftrigonometric function, which terms Fourier descriptors. Because polygon shape could bedenote as periodic function when decomposed into X and Y axis, this method could beapplicable to polygons.X axsis139.7110 35.54651 2p nt2p ntf( x ) = + an cos + bn sin2 n=1LL139.7106 t(i)139.7102139.7098 35.5460 0.0000.001 0.0020.003 0.004 0.005org_58[,2]t(xi, yi)tY axsis35.5465 1 2p nt2p nt g( y) =+ an cos + bn sin 2 n=1LL 35.545535.5460 t(i)35.5455 139.7098 139.7100 139.7102 139.7104139.7106 139.7108 139.7110 0.0000.001 0.0020.003 0.004 0.005 org_58[,1]t 5. Original Shape 6. Simplifying with approximate ShapeBy configuring higher number of harmonicsand of approximate points, shapes would bemore approximate to original shapes. 7. Inverse Fourier TransformOriginal polygons can be approximatelyOriginal ShapeFirst Approximate Ellipsereconstruct. To reconstruct original 35.5465Approximate Shape t(xj, yj)shapes, number of points should bespecified, and each point is arranged onconstant degree apart in a circle. 35.5460 Approximate with 10 pointsorg_58[,2] 1.0 1 0.5 35.5455 0.0 0 y-10 1 -0.5 -1.0 -1-1.0-0.50.0 0.5 1.0x139.7098 139.7100 139.7102 139.7104139.7106 139.7108 139.7110org_58[,1] H j 2p i j 2p i xj = ai cos + bi sin + cx i=2 L L H j 2p i j 2p i yi = ci cos + di sin + cyi=2 L L 8. Proclustes AnalysisThe aim is to obtain a similar placementand size between two shapes, byminimizing a measure of shape Find an optimum angle of rotation that thedifference called the Procrustes distance sum of the squared distances betweenbetween the objects. To conduct thiscorresponding points is minimized. nanalysis, number of control points inui yi - wi xieach shape should be same.q = tan -1 i=1 n i=1 ui xi - wi yiCalculate root mean square distance for Then, optimum coordinates are assigned byuniform scaling following fomula. ( x - x ) + ( y - y)n 2 2s=i=1 i i (hi, n i ) = ( cosqui -sinqwi,sinqui +sinqwi ) nDissimilarity between two shapes are Translate & uniform scalingmeasured as squared distance.xi - x yi - y(ui, wi ) = , d=i=1(hi - xi ) + (n i - yi ) n22 SS 9. Proclustes AnalysisProcrustes errors 35.5465 sum of squares: 35.5460 1.758e-065e-04org_58[,2] 35.5455Dimension 2 139.7098139.7102139.7106 139.71100e+00org_58[,1] 35.702-5e-04 35.700org_2570[,2] 35.698 35.696 -5e-04 0e+00 5e-04 139.650139.654139.658 Dimension 1 org_2570[,1] 10. Partition Around Medoids (PAM)Partition Around Medoids(PAM) is a clustering algorithm which attempt to minimizesquared error as well as the k-means. In contrast to k-means, PAM chooses existing pointsas centers, terms medoids, and the algorithm is more robust to noise and outliers ascompared to k-means.Silhouette plot of pam(x = tokyo.dist^2, k = 5)k n = 4373 5 clusters Cjargmin x j - mi j : nj | aveiCj si 1 : 1388 | 0.62 i=1 x j SiWhere mi is the medoid of Si.2 : 740 | 0.41$classinfo (output of PAM clustering)3 : 1070 | 0.44sizemax_dissav_diss diameter separation[1,] 138865.80418.27153 193.87860.20960664 : 693 | 0.41[2,] 740 239.5017 29.9133463.2270.1864726[3,] 1070 200.8129 31.75182 429.51830.20960665 : 482 | 0.35[4,] 693 737.196530.68781 1044.5552 0.1864726[5,] 482 460.6608 46.2136 803.36250.3181256 -0.20.0 0.2 0.4 0.6 0.8 1.0 Silhouette width si Average silhouette width : 0.48 11. Silhouette Width - Test the number of clustering -For each datum i, average dissimilarity distanceC k-=4within the same class is calculated At first.1a(i) =(a(i) - a j )2 B n(k )a(i) ,a j KiiDCalculate the lowest averaged dissimilarity todatum j of any other cluster as following. b(i) = argmin 1 (a - b )2 A n b K (i ) jK (k j ) j jThe index of clustering efficiency at datum i The index of clustering efficiency at eachis calculated as silhouette width.cluster k is average silhouette width.a(i) - b(i) S(i) (-1 Sk 1)1S(i) = (-1 S(i) 1) Sk ={ max a(i) , b(i) } n(k j ) S(i) Ki 12. Average Silhouette Width The highest average width = 5Average Silhouette Width Silhouette Width N=50Averaged with PAM from 2 to 50 clusters0.481- a(i)0.46 b(i ) if (a(i) > b(i) ) S(i) = 0if (a(i) = b(i) )0.44 b(i ) if (a(i) < b(i) )res$sila(i) -10.420.40 010 20 30 4050Index Averaged silhouette width suggests that the number of cluster = 5 13. Clustering by PAM 14. Silhouette Width 15. res$sil0.29 0.30 0.31 0.320.33 0.34 0.35 n = 4373-0.5Average silhouette width : 0.36 5 Silhouette plot of (x = tk.ward.cut3, dist = tk.dist^2)0.0 10 IndexSilhouette width si0.5 Averaged Silhouette Width N=20 15 that the number of cluster = 3" Average silhouette width suggests3 clusters Cj1.0 3 : 900 | 0.452 : 2447 | 0.341 : 1026 | 0.30j : nj | aveiCj sHeight0 50000 100000 1500003923 148108382 18184 1936288029362 132531310 17206 27020678097184422 2638582 17602 15052 232763052 18956 22255 15497 164788634 23122 56348822635 107688920 18364 253681369 148588578 11327 10388 17776 15035 162396172 12607 271126057 12024 11766 14012 23905 23918 833 124132667 14502 154364652 252717197 2489985699558 18008 26560 10571 10956 11515 16711 20874 12908 2657744034612 1887914534682 25449 21132 245625271 10375 15421 11692 2386873276924 14926 20796 13485 21036 12735 151937896 10460 19425 2228514307639 590 16410 193601137 26393 11742 136901874 120287516 24452 153409554 102564084 19498 135868056 172206462 18970 11140 10441 11593 369 153627898 23852 122986448 173583293 14018 150698248 100229542 187334885 17329 15833 24985 253992533 10084179286099961 24777 15415 23046 23255 270654401 17348 7777504 14566 19103 12164 26336 10180 11255 238481327 11891 14406 251088635 189015754 197752977 18876 136481401 159764577 25708 12580 27182 25667 26478 16618 272863186 25592342958694686921745402095 18377 18261 22296 11029 18081 482 14427 15361 22378 1061770019668 22567 2611672852812 12519 143825287 14357 12933 14864 2124425066621 10873 2280570298341284542328642 252541225 1575710735439 19118341692272059 11824 10145 24459 14568 26127604467568447 20716 1049423925281 18817 24903 271671607 22707 16421 11536 16268 27184 19855 2014755635888 19973 21356 256208719 188277526 15294 435 176189177 19896 21010 263849936 1433476243207 20000 12632 2494667599294 16148 20291 198799240 16552 21226 15671 12016 23016 154873145 1479118641075 11691 10498 247341797 193942906 16952436199785834 1601029326135 226708749 13097 15204 19858 241759866 20367 24680 167728388 17993 12514 15575 26494 19689 12545 138874756 13726 4997061 13384 19884 925 1040559896929 22536 154818552 25680 910523063116787 11339 10984 24639 12477 19517 10609 18819 20692 13509 24848 20078 336 241513602 154565446 25682 27028 8388441 258195354 1271923768054982325554226 13940 12147 17213 25863 12673 237825180 10347 15426 202012076 14366 158 15442 24820 2616329199030467160182201 15569 220924019450455725590 225745987 15354 25702 21234 25266 160001913 18425 773676879662478 2314337207417 20650 252898722 265299678 149872132 25584114969881795 128673054 11586 253679388 20326 20486 24158 26686 709 969 22425691461464591 173102414965773992762 25082 179223988 12637 13688 10476 17919 15909 2728167575411 269576409680721616381843599641064 232228495 22475 4838083 13613 204632070 21905 5537993 27470 10364 17760 22699 16163373862626334 13927 13722 12326 2422330795278 12341 10402 24824 24840 19010 10046 122274072 26582 19412 24082 25257316550071152 1037318721473 20361 191645741 256977486 26094 211823026 11652 18365 124178624 1068023752801 10784 110102257 25905 12446 14955967151782999 13335 26866 16401 190578016 24227 126651516 25061499486549639 17655 11359 20909 14622 238696508 17985 262504710 25207 14570 257208607 1936998215561 237888106 19262 16139 23116 27095 772 6559121 763 17621 18324 27202 23163 19889 209389270 20873361385 19031 13210 13523 11057 2520917796782 13809 2103153497013 150207377 214399260308602 21292 16046 192701547 22397 24947 1269649 2070738843478 140499129 159219947 13381 13787177493677880 274579719 21348 11963 24254 26800 10356 12768 211581814 24006 16537 20613 15994 14546 215841842 231558503 24574 11607 22830 24199 25101439947666534 259593439 22501 18940 25044 1054742689074 153374794 178872704 200308025 11076 13796 252825586 17057 10010 15855 24408 1835632467072 26654 230627603 23833 11850 272296499 2111255028923463061571889 13798 19806 11051 23858 26696613292315739 10679 206853587 151734607 14703 212847782 26991 10139 17248 212018524 22988 1419210368837 23236 12522 216597983 117827631 268332792 10837 15579 204375359 1831732651978 20892 332 142132006 20018 22909 15081 210925451 219977992 24632465447019209 253146214 149613967 23742 27023 11806 12402 189962472 262047934 22882 247703916 24637 4334707 10414 16124 16649 479 2552516358149 1144116 272381577629360 1897554556156579584 12667 13908 13597 13886 12781 13197 13315 16909 16998 20396 20634 17045 1756