Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "metadata": {
  5. "trusted": true
  6. },
  7. "cell_type": "code",
  8. "source": "from scipy.cluster.hierarchy import linkage\n# Build the hierarchical cluster\nZ = linkage(upper_M, method = 'average', metric = 'euclidean')\nZ[:5]",
  9. "execution_count": 41,
  10. "outputs": [
  11. {
  12. "data": {
  13. "text/plain": "array([[37. , 86. , 0.00273896, 2. ],\n [ 0. , 10. , 0.00306359, 2. ],\n [40. , 64. , 0.00358977, 2. ],\n [18. , 66. , 0.00454632, 2. ],\n [13. , 50. , 0.00481852, 2. ]])"
  14. },
  15. "execution_count": 41,
  16. "metadata": {},
  17. "output_type": "execute_result"
  18. }
  19. ]
  20. },
  21. {
  22. "metadata": {
  23. "trusted": true
  24. },
  25. "cell_type": "code",
  26. "source": "# Set the figure size and some labels\nfig, ax = plt.subplots(figsize=(25, 10))\nax.set_title('Hierarchical Clustering Dendrogram')\nax.set_xlabel('Player index')\nax.set_ylabel('Distance')\n# Plot the dendogram\n_ = sci.cluster.hierarchy.dendrogram(\n Z,\n leaf_rotation = 90.,\n leaf_font_size = 8.,\n ax = ax\n)",
  27. "execution_count": null,
  28. "outputs": []
  29. }
  30. ],
  31. "metadata": {
  32. "gist_id": "db542fba0867273b743e507a30e79e8e",
  33. "kernelspec": {
  34. "name": "python3",
  35. "display_name": "Python 3",
  36. "language": "python"
  37. },
  38. "language_info": {
  39. "name": "python",
  40. "version": "3.6.3",
  41. "mimetype": "text/x-python",
  42. "codemirror_mode": {
  43. "name": "ipython",
  44. "version": 3
  45. },
  46. "pygments_lexer": "ipython3",
  47. "nbconvert_exporter": "python",
  48. "file_extension": ".py"
  49. },
  50. "toc": {
  51. "nav_menu": {},
  52. "number_sections": true,
  53. "sideBar": true,
  54. "skip_h1_title": false,
  55. "toc_cell": false,
  56. "toc_position": {
  57. "height": "483.41033935546875px",
  58. "left": "0px",
  59. "right": "1362px",
  60. "top": "109.57880401611328px",
  61. "width": "119.0081558227539px"
  62. },
  63. "toc_section_display": "block",
  64. "toc_window_display": true
  65. },
  66. "varInspector": {
  67. "cols": {
  68. "lenName": 16,
  69. "lenType": 16,
  70. "lenVar": 40
  71. },
  72. "kernels_config": {
  73. "python": {
  74. "delete_cmd_postfix": "",
  75. "delete_cmd_prefix": "del ",
  76. "library": "var_list.py",
  77. "varRefreshCmd": "print(var_dic_list())"
  78. },
  79. "r": {
  80. "delete_cmd_postfix": ") ",
  81. "delete_cmd_prefix": "rm(",
  82. "library": "var_list.r",
  83. "varRefreshCmd": "cat(var_dic_list()) "
  84. }
  85. },
  86. "types_to_exclude": [
  87. "module",
  88. "function",
  89. "builtin_function_or_method",
  90. "instance",
  91. "_Feature"
  92. ],
  93. "window_display": false
  94. }
  95. },
  96. "nbformat": 4,
  97. "nbformat_minor": 4
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement