{ "cells": [ { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "# Politics\n", "\n", "We show how to use scikit-network to analyse the way deputies vote and their proximity to the majority. We here consider the French National Assembly (XVth legislature, from 2017 to 2020). The considered graph is the bipartite graph between deputies and bills." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "from IPython.display import SVG" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": 59, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "from sknetwork.data import load_netset\n", "from sknetwork.clustering import Louvain\n", "from sknetwork.regression import Diffusion\n", "from sknetwork.ranking import top_k\n", "from sknetwork.embedding import Spectral\n", "from sknetwork.visualization import visualize_graph" ] }, { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Data" ] }, { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "The dataset is part of the [NetSet](https://netset.telecom-paris.fr/pages/national_assembly.html) collection." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Parsing files...\n", "Done.\n" ] } ], "source": [ "graph = load_netset('fr-assembly')" ] }, { "cell_type": "code", "execution_count": 116, "metadata": { "scrolled": true, "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "biadjacency = graph.biadjacency\n", "position = graph.position\n", "names = graph.names_row\n", "bills = graph.names_col\n", "labels = graph.labels\n", "label_colors = graph.label_colors\n", "names_labels = graph.names_labels" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "n_deputy, n_bill = biadjacency.shape" ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "scrolled": true, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Non inscrit' 'Les Républicains'\n", " 'Les Constructifs : républicains, UDI, indépendants'\n", " 'Libertés et Territoires' 'UDI et Indépendants'\n", " 'UDI, Agir et Indépendants' 'Mouvement Démocrate et apparentés'\n", " 'La République en Marche' 'Socialistes et apparentés' 'Nouvelle Gauche'\n", " 'Gauche démocrate et républicaine' 'La France insoumise']\n" ] } ], "source": [ "print(names_labels)" ] }, { "cell_type": "code", "execution_count": 40, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "# parameters for visualization\n", "node_size = 4\n", "width = 480\n", "height = 300" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "scrolled": false, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "image = visualize_graph(position=position, labels=labels, node_size=node_size, width=width, height=height,\n", " label_colors=label_colors)\n", "SVG(image)" ] }, { "cell_type": "code", "execution_count": 42, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "labels_majority = [6,7]" ] }, { "cell_type": "code", "execution_count": 43, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Mouvement Démocrate et apparentés' 'La République en Marche']\n" ] } ], "source": [ "print(names_labels[labels_majority])" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/plain": [ "356" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# majority\n", "majority = np.isin(labels, labels_majority)\n", "np.sum(majority)" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/plain": [ "221" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# opposition\n", "opposition = ~np.isin(labels, labels_majority)\n", "np.sum(opposition)" ] }, { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Votes" ] }, { "cell_type": "code", "execution_count": 51, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "biadjacency_for = biadjacency > 0\n", "biadjacency_against = (-biadjacency > 0)" ] }, { "cell_type": "code", "execution_count": 52, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/plain": [ "<577x2807 sparse matrix of type ''\n", "\twith 119901 stored elements in Compressed Sparse Row format>" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "biadjacency_for" ] }, { "cell_type": "code", "execution_count": 53, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "bills_for = biadjacency_for.T.dot(np.ones(n_deputy))\n", "bills_against = biadjacency_against.T.dot(np.ones(n_deputy))\n", "bills_total = bills_for + bills_against" ] }, { "cell_type": "code", "execution_count": 54, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Average participation = 0.17\n" ] } ], "source": [ "print('Average participation = ', np.round(np.sum(bills_total) / n_bill / n_deputy, 2))" ] }, { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Clustering" ] }, { "cell_type": "code", "execution_count": 60, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "louvain = Louvain()" ] }, { "cell_type": "code", "execution_count": 61, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "labels_pred = louvain.fit_predict(biadjacency_for)" ] }, { "cell_type": "code", "execution_count": 62, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/plain": [ "(array([0, 1, 2]), array([213, 363, 1]))" ] }, "execution_count": 62, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.unique(labels_pred, return_counts=True)" ] }, { "cell_type": "code", "execution_count": 73, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "labels_pred_majority, counts_majority = np.unique(labels_pred[majority], return_counts=True)" ] }, { "cell_type": "code", "execution_count": 74, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "label_pred_majority = labels_pred_majority[np.argmax(counts_majority)]" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "execution_count": 67, "metadata": {}, "output_type": "execute_result" } ], "source": [ "image = visualize_graph(position=position, labels=labels_pred, node_size=node_size, width=width, height=height, label_colors=['red','blue', 'lightgrey'])\n", "SVG(image)" ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "neutral = np.argwhere(labels_pred==2).ravel()" ] }, { "cell_type": "code", "execution_count": 65, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Laure de La Raudière']\n" ] } ], "source": [ "print(names[neutral])" ] }, { "cell_type": "code", "execution_count": 78, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Frédérique Dumas' 'Maud Petit' 'Sonia Krimi' 'Richard Ramos'\n", " 'Sébastien Nadot']\n" ] } ], "source": [ "# dissident\n", "print(names[majority * (labels_pred!=label_pred_majority)])" ] }, { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Diffusion" ] }, { "cell_type": "code", "execution_count": 148, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "diffusion = Diffusion(n_iter=4)" ] }, { "cell_type": "code", "execution_count": 149, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "values = diffusion.fit_predict(biadjacency_for, values_row=majority)" ] }, { "cell_type": "code", "execution_count": 151, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "execution_count": 151, "metadata": {}, "output_type": "execute_result" } ], "source": [ "image = visualize_graph(position=position, scores=values, node_size=node_size,\n", " width=width, height=height)\n", "SVG(image)" ] }, { "cell_type": "code", "execution_count": 140, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Émilie Chalas' 'Didier Paris' 'Richard Ferrand'\n", " 'Élise Fajgeles|||Benjamin Griveaux' 'Guillaume Vuilletet'\n", " 'Yaël Braun-Pivet' 'Marie Guévenoux' 'Jean Terlier' 'Sacha Houlié'\n", " 'Thomas Rudigoz']\n" ] } ], "source": [ "# top-10 deputies for majority\n", "index = np.argwhere(majority).ravel()\n", "top = index[top_k(values[index], 10)]\n", "print(names[top])" ] }, { "cell_type": "code", "execution_count": 141, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Frédérique Dumas' 'Maud Petit' 'Richard Ramos' 'Agnès Thill'\n", " 'Brahim Hammouche' 'Sébastien Nadot' 'Jimmy Pahun' 'Josy Poueyto'\n", " 'Sonia Krimi' 'Max Mathiasin']\n" ] } ], "source": [ "# bottom-10 deputies for majority\n", "bottom = index[top_k(-values[index], 10)]\n", "print(names[bottom])" ] }, { "cell_type": "code", "execution_count": 142, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Ugo Bernalicis' 'Adrien Quatennens' 'Alain Bruneel' 'Clémentine Autain'\n", " 'Nicolas Dupont-Aignan' 'Alexis Corbière' 'Jean-Luc Mélenchon'\n", " 'Sébastien Jumel' 'Jean-Hugues Ratenon' 'Pierre Dharréville']\n" ] } ], "source": [ "# top-10 deputies for opposition\n", "index = np.argwhere(opposition).ravel()\n", "top = index[top_k(-values[index], 10)]\n", "print(names[top])" ] }, { "cell_type": "code", "execution_count": 143, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Jean-Luc Warsmann' 'Olivier Dassault' 'Napole Polutele|||Sylvain Brial'\n", " 'Stéphane Demilly' 'Michèle Tabarot' 'Bernard Deflesselles'\n", " 'Franck Riester|||Patricia Lemoine' 'Thierry Robert|||Jean-Luc Poudroux'\n", " 'Laure de La Raudière' 'Philippe Gomès']\n" ] } ], "source": [ "# bottom-10 deputies for opposition\n", "bottom = index[top_k(values[index], 10)]\n", "print(names[bottom])" ] }, { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Bills" ] }, { "cell_type": "code", "execution_count": 152, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "# labels are on deputies so you need an odd number of iterations\n", "diffusion = Diffusion(n_iter=5)" ] }, { "cell_type": "code", "execution_count": 153, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/plain": [ "Diffusion(n_iter=5, damping_factor=1.0)" ] }, "execution_count": 153, "metadata": {}, "output_type": "execute_result" } ], "source": [ "diffusion.fit(biadjacency_for, values_row=majority)" ] }, { "cell_type": "code", "execution_count": 154, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "values_bill = diffusion.values_col_" ] }, { "cell_type": "code", "execution_count": 158, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "l'article 27 du projet de loi de programmation 2018-2022 et de réforme pour la justice (première lecture).\n", "\n", "l'amendement de suppression n° 72 du Gouvernement à l'article 9 de la proposition de loi d'orientation et de programmation relative à la sécurité intérieure (première lecture).\n", "\n", "l'amendement de suppression n° 71 du Gouvernement à l'article 3 de la proposition de loi d'orientation et de programmation relative à la sécurité intérieure (première lecture).\n", "\n", "l'amendement n° 2362 de Mme Marsaud après l'article 60 du projet de loi portant évolution du logement, de l'aménagement et du numérique (première lecture)\n", "\n", "l'article 13 du projet de loi de programmation 2018-2022 et de réforme pour la justice (première lecture).\n", "\n" ] } ], "source": [ "# top-5 bills for majority\n", "for i in top_k(values_bill, 5):\n", " print(bills[i] + '\\n')" ] }, { "cell_type": "code", "execution_count": 159, "metadata": { "scrolled": true, "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "l'amendement n° 602 de M. Bernalicis à l'article 32 du projet de loi de programmation 2018-2022 et de réforme pour la justice (première lecture).\n", "\n", "l'amendement n° 208 de Mme Obono après l'article 31 bis du projet de loi de programmation 2018-2022 et de réforme pour la justice (première lecture).\n", "\n", "l'amendement n° 205 de Mme Obono après l'article 30 du projet de loi de programmation 2018-2022 et de réforme pour la justice (première lecture).\n", "\n", "l'amendement n° 11 de M. Bernalicis à l'article unique de la proposition de loi renforçant la lutte contre les rodéos motorisés (première lecture).\n", "\n", "l'amendement n° 272 de Mme Obono à l'article 50 du projet de loi de programmation 2018-2022 et de réforme pour la justice (première lecture).\n", "\n" ] } ], "source": [ "# top-5 bills for opposition\n", "for i in top_k(-values_bill, 5):\n", " print(bills[i] + '\\n')" ] }, { "cell_type": "code", "execution_count": 160, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "l'article unique de la proposition de loi organique visant à permettre l'inscription d'office sur la liste électorale spéciale à la consultation sur l'accession à la pleine souveraineté de la Nouvelle-Calédonie (première lecture).\n", "\n", "l'amendement n° 66 de Mme Auconie et les amendements identiques suivants à l'article premier du projet de loi renforçant la lutte contre les violences sexuelles et sexistes (première lecture).\n", "\n", "l'amendement de suppression n° 168 de Mme Obono et les amendements identiques suivants à l'article 9 ter du projet de loi pour une immigration maîtrisée, un droit d'asile effectif et une intégration réussie (nouvelle lecture).\n", "\n", "l'amendement n° 962 de la commission du développement durable et l'amendement identique suivant après l'article 14 septies du projet de loi pour l'équilibre des relations commerciales dans le secteur agricole et alimentaire et une alimentation saine et durable (première lecture).\n", "\n", "l'amendement n° 1118 de M. Clément à l'article premier du projet de loi pour une immigration maîtrisée, un droit d'asile effectif et une intégration réussie (première lecture).\n", "\n" ] } ], "source": [ "# top-5 controversial\n", "for i in top_k(-np.abs(values_bill-0.5), 5):\n", " print(bills[i] + '\\n')" ] }, { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Embedding" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "spectral = Spectral(2, normalized=False)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "embedding = spectral.fit_transform(biadjacency_for)" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "Fabien MatrasRégis JuanicoPierre Morel-À-L'HuissierJean-Marie FiévetLoïc Prud'hommeDanièle HérinClaire O'PetitJean-Paul DufrègneAnne-France BrunetAnthony CellierCorinne VignonDelphine O|||Mounir MahjoubiMax MathiasinJacques Bompard|||Marie-France LorhoDaniel FasquelleDavid LorionThierry SolèreNicole TrisseBertrand SorreChristophe LejeuneSandrine Le FeurAurélien TachéLouis AliotCécile UntermaierFannette CharvierAlexandra LouisStéphane TestéJosé EvrardDidier QuentinJean-Claude BouchetDidier Le GacJean-Christophe LagardeSébastien HuyghePierre HenrietJean-Charles LarsonneurMeyer HabibJosette ManinJean-Jacques FerraraAnnie ChapelierSacha HouliéDino CinieriMichel DelponJean-René CazeneuveFrédérique MeunierGérard MenuelJean-Charles TaugourdeauAmélie de Montchalin|||Stéphanie AtgerBoris VallaudÉric CoquerelVincent RollandJean-Claude LeclabartMartine Leguille-BalloyJacqueline DuboisMathilde PanotPaul MolacMansour KamardineBertrand PancherAlexandre HolroydDenis MasségliaGaël Le BohecElsa FaucillonMarie-Christine Verdier-JouclasMarie GuévenouxFabienne ColbocJean-Marie SermierStéphanie DoMarc Le FurJennifer De TemmermanFranck MarlinSébastien CazenoveJean-Pierre VigierCaroline JanvierJoachim Son-ForgetJean LassalleFrédérique DumasMarjolaine Meynier-MillefertOlivier Véran|||Camille Galliard-MinierBernard DeflessellesDamien PichereauPacôme RupinAdrien MorenasJérôme NuryJeanine DubiéJean-Michel ClémentBénédicte TaurineHélène Vainqueur-ChristopheChristophe BlanchetValérie Gomez-BassacRamlati AliYves Jégo|||Jean-Louis ThiériotChristophe EuzetCatherine OssonAlice ThourotVincent LedouxPatrice Verchère|||Nathalie SerreAlain DavidFrédérique LardetChristian HutinAlain PereaJean-Baptiste Djebbari|||Pierre VenteauÉric AlauzetSandra MarsaudMarie Tamarelle-VerhaegheJean-Luc WarsmannCharles de la VerpillièrePascale Fontenel-PersonneGrégory Besson-MoreauCoralie DubostOlivier DamaisinJean-François PortarrieuLaurent Pietraszewski|||Florence MorlighemCarole Bureau-BonnardNathalie SarlesBelkhir BelhaddadSandrine JossoPhilippe VigierStéphanie KerbarhSophie AuconieYaël Braun-PivetÉric PaugetJoël GiraudPhilippe HuppéJean-Philippe NilorVincent ThiébautJoël AviragnetLudovic PajotDavid HabibMaud PetitMaurice Leroy|||Pascal BrindeauAudrey Dufeu SchubertCaroline FiatEmmanuelle AnthoineGuillaume LarrivéOlivier FaureMarie-Ange MagneSonia KrimiLaurence VanceunebrockM'jid El GuerrabMohamed LaqhilaMonique LimonGuillaume VuilletetJoaquim PueyoHervé SaulignacStéphane MazarsJean TerlierStéphane Le Foll|||Sylvie TolmontGérard CherpionBérengère PolettiJean-Michel FauverguePhilippe Michel-KleisbauerRémy RebeyrottePatricia Gallerneau|||Patrick LoiseauGabriel Attal|||Florence ProvendierThierry Robert|||Jean-Luc PoudrouxCharles de CoursonValérie PetitLénaïck AdamSamantha CazebonneClaude de GanayLiliana TanguyEmmanuelle MénardCharlotte LecocqJosy PoueytoErwan BalanantRaphaël GauvainGéraldine BannierJean François MbayePierre-Henri DumontJimmy PahunVirginie Duby-MullerValérie Bazin-MalgrasValéria Faure-MuntianSylvie CharrièreIsabelle ValentinSerge LetchimyÉlise Fajgeles|||Benjamin GriveauxAgnès ThillÉric DiardNicolas TurquoisEricka BareigtsAnne-Laurence PetelRaphaël SchellenbergerChristophe Bouillon|||Bastien CoritonLaurence VichnievskySabine ThillayeNicole Dubré-ChiratPhilippe GomèsSira SyllaÉric PoulliatFrançois Cornut-GentilleGwendal RouillardRomain GrauThomas MesnierGuillaume Gouffier-ChaDidier MartinJean-Paul MatteiThierry BenoitValérie Lacroute|||Sylvie Bouchet BellecourtChristelle Dubos|||Pascal LavergneNicolas Dupont-AignanFrançois JolivetMarie-Noëlle BattistelDominique Da SilvaDominique DavidMarine BrenierÉric GirardinÉlisabeth Toutut-PicardJean-Baptiste MoreauPatrick MignolaBenoit PotterieFabien RousselMichel VialayJean-François Cesarini|||Souad ZitouniMichèle CrouzetBarbara Bessot BallotHervé BervilleGilles CarrezAndré ChassaigneCathy Racon-BouzonSylvain MaillardGeneviève LevyYolaine de CoursonSaïd AhamadaPascal BoisGilles LurtonJean-Carles GrelierJean-Pierre PontStanislas GueriniYannick KerlogotJacques SavatierNathalie ElimasAlain RamadierIan BoucardJacques MarilossianSandrine MörchMatthieu OrphelinLaurence GayteJean-Félix AcquavivaGuy BricoutFlorian BachelierBarbara PompiliAdrien QuatennensXavier BretonValérie RabaultYves DanielAgnès Firmin Le BodoJulien BorowczykStéphane ClaireauxMuriel RessiguierAina KuricMounir Belhamiti|||François de RugyMonica MichelLaurianne RossiFabien GouttefardeCédric RousselBruno BonnellMartine WonnerMickaël NogalFlorent BoudiéBenjamin DirxAdrien Taquet|||Bénédicte PételleFranck Riester|||Patricia LemoineMireille ClapotHervé PelloisLaurent GarciaMarianne DuboisBruno DuvergéJosiane CorneloupAlain BruneelJean-Louis TouraineMarine Le PenSylvain WasermanBernard ReynèsBernard BrochandPhilippe ChassaingSarah El HaïryPatrick VignalSophie PanonacleSophie ErranteSabine RubinStéphanie RistOlivier GaillardJean-Luc LagleizeGrégory Galbadon|||Stéphane TravertIsabelle Muller-Quoy|||Antoine SavignatSophie Beaudouin-HubiereChristian JacobCélia de LavergneHugues RensonPascale BoyerMarguerite Deprez-AudebertChristophe Di PompeoChristine HennionAnne BrugneraPierre VatinMartial SaddierPatrice AnatoNatalia PouzyreffJean-Noël BarrotMichel CastellaniRichard FerrandPatrice PerrotUgo BernalicisMarc Fesneau|||Stéphane BauduYannick Favennec BecotAurélien PradiéBlandine BrocardYannick HauryPierre CabaréStéphane BuchouClémentine AutainÉric CiottiPhilippe FolliotJustine BeninBruno MillienneMarie-George BuffetBérangère CouillardPerrine GouletAndré VilliersFabrice Le VigoureuxÉric WoerthLudovic MendesBrigitte BourguignonPatricia MirallèsFadila KhattabiLionel CausseDelphine BagarryValérie BeauvaisAnnaïg Le MeurRodrigue KokouendoMarielle de SarnezJérôme LambertMarion LenneMichèle de VaucouleursBrahim HammoucheOlivia GregoireStéphane ViryFiona LazaarChristophe JerretieClaude Goasguen|||Sandra BoëlleMireille RobertFrançois-Michel LambertMoetai BrothersonHubert Julien-LaferrièreClaire PitollatJean-Luc ReitzerJean-Paul LecoqLaurence Trastour-IsnartStéphane TrompilleCyrille Isaac-SibillePierre CordierÉlodie Jacquier-LaforgeStéphane DemillyMichel HerbillonAnnie GenevardDidier BaichèreJean-Louis MassonLise MagnierMarie LebecVéronique RiottonMarie-Pierre RixainCendra MotinNicole Le PeihJean-Luc FugitCarole GrandjeanVéronique LouwagieYves BleinJacques KrabalBenoit SimianBertrand BouyxCatherine FabreAnne GenetetHuguette TiegnaDenis SommerCécile RilhacVincent BruMichel ZumkellerPierre PersonMichèle PeyronFrédéric PetitDanièle ObonoPhilippe BoloFrédéric ReissSophie MetteFrédérique TuffnellSébastien JumelMarietta KaramanliThomas RudigozDominique PotierBruno FuchsValérie BoyerCédric VillaniArnaud VialaSébastien ChenuNadia EssayanSébastien LeclercMichèle TabarotGeorge Pau-LangevinBruno Nestor Azerot|||Manuéla Kéclard-MondésirChristine Pires BeauneValérie OppeltPhilippe ChalumeauJean-Luc MélenchonSereine MauborgneHélène ZannierChristine Cloarec-Le NabourDidier ParisRichard RamosJean-Michel JacquesJean-Louis BricoutPierre-Yves BournazelJean-Jacques GaultierThibault BazinFrédéric BarbierPhilippe LatombeDamien AdamDanièle CazarianGilbert Collard|||Nicolas MeizonnetChristophe NaegelenTyphanie DegoisVincent DescoeurBénédicte PeyrolJean-Pierre DoorSylvia PinelIsabelle RauchMustapha LaabidDimitri HoubronPhilippe BertaJean-Charles Colas-RoyFlorence GranjusNicolas DémoulinHubert WulfrancRobin RedaÉmilie ChalasBruno JoncourOlivier Dussopt|||Michèle VictoryAnne BlancNaïma MoutchouDaniel LabaronneAude LuquetDamien AbadOlivier FalorniFabrice BrunMaxime MinotAlexis CorbièreGabriel ServilleLuc Carvounas|||Sarah TailleboisLoïc KervranBéatrice DescampsPierre DharrévilleJean-Louis BourlangesAlexandra Valetta ArdissonBernard PerrutSébastien NadotThierry MichelsFabien Di FilippoAlbane GaillotJean-Hugues RatenonLoïc DombrevalCécile MuschottiGuy TeissierManuel Valls|||Francis ChouatPaul ChristopheOlivier BechtRémi DelatteFrançois Cormier-BouligeonGuillaume KasbarianBruno QuestelJean-François EliaouPatrick HetzelBéatrice PironJacques MaireThomas GassilloudOlga GivernetJean-Philippe ArdouinPaul-André ColombaniÉmilie CariouZivka ParkRichard LiogerFlorence LasserreLaure de La RaudièreJacques CattinFrançoise DumasDelphine BathoEmmanuel MaquetRaphaël GérardBuon TanFrancis Vercamer|||Valérie SixPhilippe DunoyerÉric BothorelLaëtitia Romeiro DiasGilles Le GendreSéverine GipsonBrigitte KusterAnissa KhedherJean-Bernard SempastousOlivier DassaultPierre-Alain RaphanPieyre-Alexandre AngladeChristophe ArendDanielle BruleboisPhilippe GosselinJean-Pierre CubertafonMarc DelatteGraziella MelchiorLaurence Maillart-MéhaignerieStéphane PeuValérie ThomasJean-Michel MisLaurence DumontJacqueline MaquetJulien DiveAlain TourretXavier PaluszkiewiczAude AmadouGuillaume GarotClaire Guion-FirminOlivier ServaStella DupontÉmilie GuerelGuillaume ChicheAnnie VidalÉmilie BonnivardMichel LauzzanaÉric StraumannXavier BatutCatherine KamowskiPaula FortezaMaina SageNadia HaiJean-François ParigiNadia RamassamyBruno StuderMarie-Christine DallozAurore BergéBruno BildeHuguette Bello|||Olivier HoarauLaurent Furst|||Philippe MeyerLaetitia Saint-PaulAlexandre FreschiNicole SanquerCaroline AbadieAnne-Christine LangFrançois PupponiRoland LescureJean-Marc ZulesiOlivier MarleixJean-Yves BonyFabien LainéBérangère AbbaLaurent Saint-MartinXavier RoserenEmmanuelle Fontaine-DomeizelBastien LachaudGuillaume PeltierJulien AubertAnne-Laure CattelotMonique IborraGisèle BiémouretFrançois André|||Claudia RouauxNathalie BassireIsabelle FlorennesMichel FangetJean-Jacques BrideyVéronique HammererNapole Polutele|||Sylvain BrialConstance Le GripAmélia LakrafiBrigitte LisoLaetitia AviaNicolas ForissierAntoine HerthAude Bono-VandormeCéline CalvezFrédéric DescrozailleFrançois RuffinMichel Larive" ], "text/plain": [ "" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "image = visualize_graph(position=embedding, names=names, labels=labels, node_size=5, width=400, height=1000,\n", " label_colors=label_colors)\n", "SVG(image)\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 2 }