Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "from scipy.cluster.hierarchy import linkage\n# Build the hierarchical cluster\nZ = linkage(upper_M, method = 'average', metric = 'euclidean')\nZ[:5]",
- "execution_count": 41,
- "outputs": [
- {
- "data": {
- "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. ]])"
- },
- "execution_count": 41,
- "metadata": {},
- "output_type": "execute_result"
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "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)",
- "execution_count": null,
- "outputs": []
- }
- ],
- "metadata": {
- "gist_id": "db542fba0867273b743e507a30e79e8e",
- "kernelspec": {
- "name": "python3",
- "display_name": "Python 3",
- "language": "python"
- },
- "language_info": {
- "name": "python",
- "version": "3.6.3",
- "mimetype": "text/x-python",
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "pygments_lexer": "ipython3",
- "nbconvert_exporter": "python",
- "file_extension": ".py"
- },
- "toc": {
- "nav_menu": {},
- "number_sections": true,
- "sideBar": true,
- "skip_h1_title": false,
- "toc_cell": false,
- "toc_position": {
- "height": "483.41033935546875px",
- "left": "0px",
- "right": "1362px",
- "top": "109.57880401611328px",
- "width": "119.0081558227539px"
- },
- "toc_section_display": "block",
- "toc_window_display": true
- },
- "varInspector": {
- "cols": {
- "lenName": 16,
- "lenType": 16,
- "lenVar": 40
- },
- "kernels_config": {
- "python": {
- "delete_cmd_postfix": "",
- "delete_cmd_prefix": "del ",
- "library": "var_list.py",
- "varRefreshCmd": "print(var_dic_list())"
- },
- "r": {
- "delete_cmd_postfix": ") ",
- "delete_cmd_prefix": "rm(",
- "library": "var_list.r",
- "varRefreshCmd": "cat(var_dic_list()) "
- }
- },
- "types_to_exclude": [
- "module",
- "function",
- "builtin_function_or_method",
- "instance",
- "_Feature"
- ],
- "window_display": false
- }
- },
- "nbformat": 4,
- "nbformat_minor": 4
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement