Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.55 KB | None | 0 0
  1. # self contained example
  2. library(cluster)
  3. strangeData <- c(-0.866285627488327,1,0,0
  4. ,-0.510951849076121,0,0,1
  5. ,-1.17167514108559,0,1,0
  6. ,-0.376762528272389,1,0,0
  7. ,0.78146409125879,0,1,0
  8. ,1.61782054548358,0,0,1
  9. ,1.13870520606875,1,0,0
  10. ,-1.13486644861899,0,0,1
  11. ,-0.206927567036607,0,0,0
  12. ,-0.207869481212349,0,0,1
  13. ,-0.744628008025243,0,1,0
  14. ,0.731433838031448,0,0,1
  15. ,1.62303204478421,0,1,0
  16. ,0.336307634488861,1,0,0
  17. ,1.81605021862297,1,0,0
  18. ,-0.750411588420933,1,0,0
  19. ,-0.0238025825151884,0,1,0
  20. ,-1.15317047678752,0,0,1
  21. ,-1.16535479706466,0,1,0
  22. ,-0.902957290471365,0,1,0
  23. ,0.757365905566296,0,0,0
  24. ,0.327956357831982,1,0,0
  25. ,-1.21209036793528,1,0,0
  26. ,-0.827813655803123,0,0,1
  27. ,1.29462065083151,1,0,0
  28. ,-1.18875004333554,0,0,1
  29. ,0.30436829237833,1,0,0
  30. ,0.686761122942272,0,0,1
  31. ,0.348318524543705,0,0,0
  32. ,0.00772114748248065,0,1,0
  33. ,-0.0654531320746511,0,1,0
  34. ,-0.871825468631758,1,0,0
  35. ,-0.24260740899128,1,0,0
  36. ,1.6316283625827,0,0,0
  37. ,-0.157380038359798,1,0,0
  38. ,-1.13594228151195,0,0,1
  39. ,0.397846678544776,0,0,0
  40. ,-1.79295787039272,0,1,0
  41. ,0.659894781274625,0,0,0
  42. ,-0.170073590508157,0,0,0
  43. ,-0.813943074670405,0,0,0
  44. ,-0.382343008302335,0,1,0
  45. ,1.00965255945214,1,0,0
  46. ,-0.325407591983216,0,0,0
  47. ,-0.192348595055317,0,1,0
  48. ,-0.776963720822561,0,0,1
  49. ,0.412818265336597,0,0,0
  50. ,-0.372215722029941,0,1,0
  51. ,-0.626596060936548,1,0,0
  52. ,1.77998358890641,0,0,1
  53. ,1.28471804407001,1,0,0
  54. ,2.30521501151449,0,0,1
  55. ,-0.0434857353479769,0,1,0
  56. ,0.129337095832911,0,0,0
  57. ,0.490060486314237,0,0,0
  58. ,0.0219239584969476,0,1,0
  59. ,2.16246213170809,1,0,0
  60. ,-1.6463259663705,0,1,0
  61. ,-1.25945578842163,0,1,0
  62. ,-0.0508902150466008,1,0,0
  63. ,-0.761232947984076,0,0,1
  64. ,-1.0844017226841,1,0,0
  65. ,0.768163697492781,1,0,0
  66. ,0.0512967198361093,0,0,0
  67. ,0.496505407614941,0,1,0
  68. ,-0.875095658442669,0,0,0
  69. ,0.356165420230564,0,1,0
  70. ,-1.48736915282316,0,0,0
  71. ,0.605835916959207,1,0,0
  72. ,0.150248856364222,0,0,1
  73. ,0.436072890825432,0,0,0
  74. ,-1.2477307042077,0,1,0
  75. ,-0.925825618397317,0,0,1
  76. ,-0.865719152703743,0,0,0
  77. ,1.49904943876406,0,0,0
  78. ,-2.000710979317,0,0,0
  79. ,-0.592352714624327,0,0,0
  80. ,0.393289445874399,0,1,0
  81. ,-0.394123590756249,1,0,0
  82. ,-0.352673107317825,0,0,1
  83. ,0.695357507195699,0,0,1
  84. ,-0.0040347449129765,0,1,0
  85. ,-0.127791150003591,0,0,1
  86. ,0.474647838412314,1,0,0
  87. ,0.621985643440749,0,1,0
  88. ,-0.0963944386034655,0,0,0
  89. ,-0.0769711593827088,0,0,1
  90. ,1.52062637216907,0,1,0
  91. ,-0.0171131048538696,0,0,1
  92. ,-0.614781568866571,0,0,1
  93. ,-0.428078937440796,0,0,1
  94. ,1.46996872384325,0,0,1
  95. ,1.33611500009041,0,1,0
  96. ,0.0849546480618341,1,0,0
  97. ,1.16189138672992,0,1,0
  98. ,-0.0892214257894575,0,0,1
  99. ,0.639365524696794,0,0,1
  100. ,0.601135082783273,1,0,0
  101. ,0.507344807255368,1,0,0
  102. ,-0.933432615481704,0,1,0
  103. ,1.0605270726388,1,0,0
  104. ,-0.846884297959019,0,1,0
  105. ,0.069757909351883,0,0,0
  106. ,0.971079516592758,0,0,1
  107. ,2.13895542286282,0,1,0
  108. ,-1.07521573310271,0,0,0
  109. ,-0.578762770935955,0,0,1
  110. ,0.138245534658141,0,1,0
  111. ,0.472499258515774,0,1,0
  112. ,-0.955048693548485,0,1,0
  113. ,-0.541270774805467,0,0,0
  114. ,-0.965725893217509,0,1,0
  115. ,1.23937418822633,0,0,0
  116. ,0.572605101793754,0,0,1
  117. ,1.25059599135706,0,0,0
  118. ,0.224476582002008,0,1,0
  119. ,-0.0466083676818374,1,0,0
  120. ,1.58857119911245,0,0,1
  121. ,-1.85121285531852,1,0,0
  122. ,0.506446004536966,0,0,0
  123. ,0.00529547247104709,0,1,0
  124. ,-0.67761610257275,0,1,0
  125. ,-0.050520398113479,1,0,0
  126. ,1.09977836234059,0,0,0
  127. ,-0.729074108182476,0,0,0
  128. ,-0.0290602916500079,0,0,0
  129. ,0.610785941871284,1,0,0
  130. ,0.224899327520079,1,0,0
  131. ,1.01797352389614,0,0,0
  132. ,0.258960174013477,1,0,0
  133. ,-0.0173109255243736,1,0,0
  134. ,1.15675575673647,0,0,0
  135. ,-1.40075651100777,0,1,0
  136. ,1.29973838021484,0,0,0
  137. ,-2.19964416776033,0,1,0
  138. ,1.43949364450352,0,0,1
  139. ,1.07342747391928,0,0,1
  140. ,-1.20048803661996,0,0,0
  141. ,-0.346455976764648,0,0,0
  142. ,-0.480774942257163,0,1,0
  143. ,-0.743609323884268,0,1,0
  144. ,1.54622738113784,0,1,0
  145. ,-0.403898403935946,0,0,0
  146. ,-0.833433145942438,1,0,0
  147. ,-0.219164470718774,1,0,0
  148. ,0.12696814119287,1,0,0
  149. ,-0.322315905835392,0,0,0
  150. ,-0.350597318362615,1,0,0
  151. ,-0.657947808709103,0,0,1
  152. ,-1.3599769112632,0,1,0
  153. ,-0.101630823838928,0,0,0
  154. ,-1.34660046284197,1,0,0
  155. ,-2.42751597395552,0,1,0
  156. ,-0.890211205480196,1,0,0
  157. ,-1.24558895213474,0,0,1
  158. ,0.18700333641652,1,0,0
  159. ,2.5082251629743,1,0,0
  160. ,1.33292648093108,1,0,0
  161. ,-0.38816796929655,0,0,1
  162. ,-0.340299350153559,0,0,1
  163. ,-0.360408688017778,0,0,1
  164. ,0.184527132500589,0,0,1
  165. ,-0.945284123204619,0,0,0
  166. ,-0.447915791428278,0,0,0
  167. ,0.960837246768647,0,1,0
  168. ,0.261390181284487,0,0,1
  169. ,1.99391928572872,1,0,0
  170. ,1.63328530659267,0,1,0
  171. ,0.841678645192176,0,1,0
  172. ,0.807348533253569,0,1,0
  173. ,-1.69473655701435,0,0,0
  174. ,-2.95460714558617,1,0,0
  175. ,-1.64969453370585,0,0,1
  176. ,-0.484414672869815,0,1,0
  177. ,-0.526272870810604,0,0,0
  178. ,0.051830062343814,0,0,1
  179. ,1.26507516617792,1,0,0
  180. ,-1.41617967114385,0,0,0
  181. ,0.236754759425436,0,0,0
  182. ,0.904212403266786,0,0,1
  183. ,2.42448681816761,0,0,1
  184. ,-1.57101731154911,1,0,0
  185. ,-0.471525015273919,0,0,1
  186. ,-0.777691881154585,0,0,0
  187. ,-0.33500864971305,1,0,0
  188. ,-0.804758127002811,1,0,0
  189. ,1.31836909690498,0,0,1
  190. ,0.0609487604963864,0,0,0
  191. ,-0.443936034513707,0,0,0
  192. ,0.740834846236723,0,0,1
  193. ,-2.14041576208016,0,0,0
  194. ,-0.650625084741614,0,0,1
  195. ,-0.314809179050786,0,0,0
  196. ,0.623191053756259,0,0,0
  197. ,-0.861527811786575,0,0,0
  198. ,-0.495712634432739,0,0,0
  199. ,-1.15138427720019,0,0,0
  200. ,-0.0368657006311513,0,0,1
  201. ,0.808099625439217,0,1,0
  202. ,2.04358789173449,0,1,0
  203. ,-0.361230312246911,0,1,0
  204. ,-1.43757174215673,0,0,1
  205. ,-0.0126368333853388,0,0,1
  206. ,-0.55062321407905,0,0,1
  207. ,-0.598669467196556,0,0,0
  208. ,0.553538760296604,0,1,0
  209. ,0.0331404550587805,0,1,0
  210. ,-1.01641207011743,0,0,0
  211. ,-0.969763233966749,1,0,0
  212. ,-0.115985687817581,0,0,0
  213. ,-1.44923317467671,0,1,0
  214. ,0.58359088336307,0,0,1
  215. ,1.02177931523912,0,0,0
  216. ,-0.772903258762401,0,1,0
  217. ,-0.833203951806085,1,0,0
  218. ,-0.121756851474623,0,0,1
  219. ,0.333735580183243,0,0,0
  220. ,0.841447311750965,0,0,1
  221. ,-0.202542681685737,1,0,0
  222. ,-0.363835977102042,0,0,1
  223. ,-0.763208653073085,0,0,0
  224. ,-0.404233770949925,0,0,0
  225. ,-0.626967850505697,0,0,1
  226. ,1.51902583641424,0,0,1
  227. ,0.152334670353581,1,0,0
  228. ,-0.37793809368425,0,1,0
  229. ,0.958745025661511,1,0,0
  230. ,-1.44235110382376,0,1,0
  231. ,0.0234173973335753,0,0,1
  232. ,0.381965794662393,0,0,0
  233. ,-0.987421186811441,1,0,0
  234. ,0.680391323949574,1,0,0
  235. ,-0.200195019135693,1,0,0
  236. ,-1.11687467522201,0,0,1
  237. ,0.484415933230296,0,0,0
  238. ,0.66465930418491,1,0,0
  239. ,0.135520835347015,0,0,0
  240. ,-0.0135948380436641,0,0,0
  241. ,-0.174610953673981,1,0,0
  242. ,-0.385258324842704,0,0,1
  243. ,0.0736764406605341,0,1,0
  244. ,0.433497723474607,0,0,1
  245. ,-1.57962309060262,0,0,1
  246. ,0.630090656840841,1,0,0
  247. ,0.973500666410068,0,1,0
  248. ,-0.509883991863271,0,1,0
  249. ,0.776678864294335,1,0,0
  250. ,1.06439033722933,0,0,1
  251. ,0.631572825803999,0,0,1
  252. ,0.736226086691134,0,0,0
  253. ,-1.23321773011943,1,0,0
  254. ,-0.388575379622945,0,1,0
  255. ,1.0632151634506,0,0,1
  256. ,1.05814098386583,0,0,0
  257. ,0.408184424450004,0,0,1
  258. ,0.531436889048738,1,0,0
  259. ,2.20381966762526,0,0,1
  260. ,2.11422588577572,0,0,1
  261. ,-0.531704962557588,0,0,0
  262. ,1.34561800389927,0,0,1
  263. ,0.273769623933743,1,0,0
  264. ,-0.372910934670834,0,0,1
  265. ,-0.470566520010902,1,0,0
  266. ,-0.75477217389578,0,1,0
  267. ,-0.501842228377673,0,0,1
  268. ,-1.25532930322808,0,0,0
  269. ,-0.286477761094775,1,0,0
  270. ,-0.823694457831787,0,0,1
  271. ,0.797314566796799,0,0,1
  272. ,-0.0600523761224243,0,1,0
  273. ,0.657605378335186,0,0,0
  274. ,-0.725821254759635,0,1,0
  275. ,-1.1218762657447,0,1,0
  276. ,1.02390098776472,1,0,0
  277. ,-0.125900354616813,0,1,0
  278. ,-0.110600677983877,0,0,1
  279. ,0.362848077657443,0,1,0
  280. ,1.75245676080733,0,0,1
  281. ,-1.53945786644643,0,0,0
  282. ,-1.69041842719508,1,0,0
  283. ,2.21366606351434,0,1,0
  284. ,1.59672297659057,0,0,1
  285. ,1.36855862766991,0,0,0
  286. ,-0.59109080681349,1,0,0
  287. ,0.344628944020705,0,0,0
  288. ,-0.547730633367544,1,0,0
  289. ,3.28229260418702,0,1,0
  290. ,0.186377905391717,0,0,1
  291. ,-0.85647024545773,0,0,0
  292. ,-2.10613283819929,1,0,0
  293. ,1.0659329233981,1,0,0
  294. ,0.197594622321815,0,0,0
  295. ,-1.5165240972921,0,0,1
  296. ,-1.10653359569001,0,0,0
  297. ,-0.702450947236347,0,1,0
  298. ,0.561612881169714,0,1,0
  299. ,0.0618497778342936,0,1,0
  300. ,-1.61352989112514,0,0,1
  301. ,-0.380008609813976,0,1,0
  302. ,0.485668785864403,1,0,0
  303. ,1.44073309607887,0,0,0
  304. ,-0.631502388683978,0,1,0
  305. ,0.924636979461146,0,1,0
  306. ,-0.385053889933482,1,0,0
  307. ,1.7335479754834,1,0,0
  308. ,0.804525293681982,0,0,1
  309. ,-0.991585017557505,0,1,0
  310. ,1.35969572742296,0,1,0
  311. ,0.76841232389423,0,1,0
  312. ,-0.133117031661697,1,0,0
  313. ,-1.57093944605932,1,0,0
  314. ,0.0463315954106568,1,0,0
  315. ,0.0400112040904778,0,1,0
  316. ,0.542965613556832,0,0,1
  317. ,-0.951132065936325,0,1,0
  318. ,1.0236860490532,1,0,0
  319. ,-1.65166967479243,1,0,0
  320. ,-0.31690124841045,1,0,0
  321. ,-0.236230990447918,1,0,0
  322. ,2.15914099741492,1,0,0
  323. ,1.31763979031855,0,0,1
  324. ,-0.607279994041944,0,0,1
  325. ,1.13453737158436,0,0,1
  326. ,0.6701910306058,0,1,0
  327. ,-0.564864937395887,1,0,0
  328. ,0.926205103954728,1,0,0
  329. ,-0.980200111995638,0,1,0
  330. ,0.437252455381278,0,1,0
  331. ,-1.13416837126914,0,1,0
  332. ,0.780011292450117,0,0,0
  333. ,0.558179248192722,0,0,1
  334. ,-0.788560632585296,0,0,1
  335. ,1.42188103521719,1,0,0
  336. ,-1.25403745185199,0,1,0
  337. ,-0.961543192416867,0,0,1
  338. ,0.272005872845942,0,0,0
  339. ,-0.3754160451173,1,0,0
  340. ,-1.40457905909558,0,0,0
  341. ,0.0564752608649083,0,1,0
  342. ,0.0717952713169958,1,0,0
  343. ,1.27361011457374,0,1,0
  344. ,-1.13881319792865,0,0,1
  345. ,-1.43642545765708,0,0,0
  346. ,1.56419289350468,0,0,0
  347. ,-0.539863901494306,1,0,0
  348. ,-0.649284486134111,0,0,1
  349. ,-0.816485163999317,0,0,0
  350. ,-0.586168990002293,0,0,0
  351. ,1.33236676326001,0,0,0
  352. ,0.897539764461409,1,0,0)
  353.  
  354. strangeData <- matrix(strangeData,byrow=T,ncol=4)
  355.  
  356. # Remove any column (and probably any row) and it works
  357. # Decrease samples below 42 and it works
  358. # Set sampsize to 199 or 201 and it works
  359. # Change distance to euclidean and it works
  360. # set pamLike to F and it works
  361. resClaraManDum <- clara(
  362. x=strangeData
  363. ,k=2
  364. ,metric='manhattan'
  365. ,samples=42
  366. ,sampsize=200
  367. ,pamLike=T
  368. )
  369.  
  370. sessionInfo()
  371.  
  372. R version 3.0.2 (2013-09-25)
  373. Platform: x86_64-w64-mingw32/x64 (64-bit)
  374.  
  375. locale:
  376. [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
  377. [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
  378. [5] LC_TIME=English_United States.1252
  379.  
  380. attached base packages:
  381. [1] stats graphics grDevices utils datasets methods base
  382.  
  383. other attached packages:
  384. [1] cluster_1.14.4
  385.  
  386. loaded via a namespace (and not attached):
  387. [1] tools_3.0.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement