From 46cf7d02eef688299e26cf4c77b3dcffb4b1e8d1 Mon Sep 17 00:00:00 2001 From: SUR Frederic <frederic.sur@univ-lorraine.fr> Date: Sun, 17 Nov 2024 20:37:01 +0000 Subject: [PATCH] 2024-2025 --- TP2/TP2_ex2_sujet.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TP2/TP2_ex2_sujet.ipynb b/TP2/TP2_ex2_sujet.ipynb index cc77ce3..3399132 100644 --- a/TP2/TP2_ex2_sujet.ipynb +++ b/TP2/TP2_ex2_sujet.ipynb @@ -264,7 +264,7 @@ "import matplotlib.pyplot as plt\n", "from scipy.cluster.hierarchy import dendrogram\n", "from sklearn.cluster import AgglomerativeClustering\n", - "%matplotlib notebook" + "%matplotlib inline" ] }, { @@ -272,7 +272,7 @@ "id": "ff5c683c", "metadata": {}, "source": [ - "...et on définit dans la cellule suivante une fonction `plot_dendrogram` permettant d'afficher le dendrogramme issu d'une classification calculée par la fonction `AgglomerativeClustering` de scikit-learn (on n'utilise pas la classification hiérarchique de scipy, contrairement à l'exercice 1)." + "...et on définit dans la cellule suivante une fonction `plot_dendrogram` permettant d'afficher le dendrogramme issu d'une classification calculée par la fonction `AgglomerativeClustering` de scikit-learn." ] }, { @@ -328,7 +328,7 @@ "m = len(Data)\n", "editdist = np.zeros((m,m))\n", "\n", - "# votre code ici (calcul du tableau editdist, prend approximativement 2 minutes): \n" + "# votre code ici (calcul du tableau editdist, prend une à deux minutes): \n" ] }, { @@ -384,7 +384,7 @@ "metadata": {}, "outputs": [], "source": [ - "model = AgglomerativeClustering(linkage=\"single\",distance_threshold=0,n_clusters=None,affinity='precomputed')\n", + "model = AgglomerativeClustering(linkage=\"single\",distance_threshold=0,n_clusters=None,metric='precomputed')\n", "model = model.fit(editdist)\n", "plt.figure(figsize=[9,6])\n", "plot_dendrogram(model,labels=Names)\n", -- GitLab