|
7 | 7 | "colab_type": "text"
|
8 | 8 | },
|
9 | 9 | "source": [
|
10 |
| - "<a href=\"https://colab.research.google.com/github/polis-community/red-dwarf/blob/main/docs/notebooks/polis-implementation-demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" |
| 10 | + "<a href=\"https://colab.research.google.com/github/polis-community/red-dwarf/blob/2025-06-02-patcon/docs/notebooks/polis-implementation-demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" |
11 | 11 | ]
|
12 | 12 | },
|
13 | 13 | {
|
|
18 | 18 | "base_uri": "https://localhost:8080/"
|
19 | 19 | },
|
20 | 20 | "id": "kEyVHx6y7zpu",
|
21 |
| - "outputId": "fc4e261e-4328-4241-b2e8-bd5d80b1f740" |
| 21 | + "outputId": "edae961b-e68b-4ca6-8d67-38f36bc6d970" |
22 | 22 | },
|
23 | 23 | "outputs": [
|
24 | 24 | {
|
|
28 | 28 | " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
|
29 | 29 | " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
|
30 | 30 | " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
|
31 |
| - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m116.1/116.1 kB\u001b[0m \u001b[31m26.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
32 |
| - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m161.7/161.7 kB\u001b[0m \u001b[31m23.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
33 |
| - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m61.4/61.4 kB\u001b[0m \u001b[31m194.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
34 |
| - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m66.5/66.5 kB\u001b[0m \u001b[31m158.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
| 31 | + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m116.1/116.1 kB\u001b[0m \u001b[31m7.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
| 32 | + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m161.7/161.7 kB\u001b[0m \u001b[31m19.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
| 33 | + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m61.4/61.4 kB\u001b[0m \u001b[31m166.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
| 34 | + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m69.2/69.2 kB\u001b[0m \u001b[31m138.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
35 | 35 | "\u001b[?25h Building wheel for red-dwarf (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n"
|
36 | 36 | ]
|
37 | 37 | }
|
|
48 | 48 | "base_uri": "https://localhost:8080/"
|
49 | 49 | },
|
50 | 50 | "id": "NkGdoHCy8RdA",
|
51 |
| - "outputId": "ac246841-e319-494f-eb90-431fec639bc2" |
| 51 | + "outputId": "b64eb1be-64a6-4e2a-91c4-8debdffeb9d5" |
52 | 52 | },
|
53 | 53 | "outputs": [
|
54 | 54 | {
|
|
125 | 125 | "\n",
|
126 | 126 | "# In this conversation, any -1 is moderated out. Matches upstream behavior.\n",
|
127 | 127 | "# TODO: Investigate why is_strict_moderation doesn't affect this.\n",
|
128 |
| - "_, _, mod_out_statement_ids, _ = process_statements(statements)\n", |
| 128 | + "_, _, mod_out_statement_ids, meta_statement_ids = process_statements(statements)\n", |
129 | 129 | "print(f\"{math_data['mod-out']=}\")\n",
|
130 | 130 | "print(f\"{mod_out_statement_ids=}\")\n",
|
131 | 131 | "\n",
|
|
137 | 137 | ],
|
138 | 138 | "metadata": {
|
139 | 139 | "id": "EAfHaFFIhYw7",
|
140 |
| - "outputId": "18e03149-988a-4919-e8a5-41a3791a782a", |
| 140 | + "outputId": "f83c0154-20e5-482d-90eb-d7121fd0b26b", |
141 | 141 | "colab": {
|
142 | 142 | "base_uri": "https://localhost:8080/"
|
143 | 143 | }
|
144 | 144 | },
|
145 |
| - "execution_count": 3, |
| 145 | + "execution_count": 8, |
146 | 146 | "outputs": [
|
147 | 147 | {
|
148 | 148 | "output_type": "stream",
|
|
162 | 162 | "result = run_clustering(\n",
|
163 | 163 | " votes=votes,\n",
|
164 | 164 | " mod_out_statement_ids=mod_out_statement_ids,\n",
|
| 165 | + " meta_statement_ids=meta_statement_ids,\n", |
165 | 166 | " # If clustering is getting ready to find a new k, more need to uncomment\n",
|
166 | 167 | " # this to properly reproduce Polis visualization.\n",
|
167 | 168 | " #\n",
|
|
182 | 183 | "base_uri": "https://localhost:8080/"
|
183 | 184 | },
|
184 | 185 | "id": "HnTewjhSIb0a",
|
185 |
| - "outputId": "e4c69d54-3382-4225-8c7f-01a84a783fdd" |
| 186 | + "outputId": "90fd02f8-95ea-43c7-db0f-208ff57ea146" |
186 | 187 | },
|
187 |
| - "execution_count": 4, |
| 188 | + "execution_count": 9, |
188 | 189 | "outputs": [
|
189 | 190 | {
|
190 | 191 | "output_type": "stream",
|
|
223 | 224 | "height": 469
|
224 | 225 | },
|
225 | 226 | "id": "u_NmYu_bIfLR",
|
226 |
| - "outputId": "d5bd08da-447d-429d-9990-c99113ea886a" |
| 227 | + "outputId": "e946c98b-fa86-4802-bcfa-a142b6503512" |
227 | 228 | },
|
228 |
| - "execution_count": 5, |
| 229 | + "execution_count": 10, |
229 | 230 | "outputs": [
|
230 | 231 | {
|
231 | 232 | "output_type": "stream",
|
|
265 | 266 | {
|
266 | 267 | "cell_type": "code",
|
267 | 268 | "source": [
|
268 |
| - "from reddwarf.utils.stats import select_representative_statements\n", |
269 |
| - "from reddwarf.data_presenter import print_repness\n", |
| 269 | + "from reddwarf.data_presenter import print_selected_statements\n", |
270 | 270 | "\n",
|
271 |
| - "repness = select_representative_statements(\n", |
272 |
| - " grouped_stats_df=result.group_comment_stats,\n", |
273 |
| - " mod_out_statement_ids=mod_out_statement_ids,\n", |
274 |
| - ")\n", |
275 |
| - "print_repness(repness=repness, statements_data=statements)\n" |
| 271 | + "print_selected_statements(result=result, statements_data=statements)\n" |
276 | 272 | ],
|
277 | 273 | "metadata": {
|
278 | 274 | "id": "06pUuMhWKw5H",
|
279 |
| - "outputId": "f9b0c6f4-e1f2-49cc-c4c4-ce7b6daa5c08", |
| 275 | + "outputId": "8add8b42-b47b-47be-e1b9-65fe1215f6df", |
280 | 276 | "colab": {
|
281 | 277 | "base_uri": "https://localhost:8080/"
|
282 | 278 | }
|
283 | 279 | },
|
284 |
| - "execution_count": 6, |
| 280 | + "execution_count": 11, |
285 | 281 | "outputs": [
|
286 | 282 | {
|
287 | 283 | "output_type": "stream",
|
288 | 284 | "name": "stdout",
|
289 | 285 | "text": [
|
290 |
| - "GROUP A\n", |
| 286 | + "# CONSENSUS STATEMENTS\n", |
| 287 | + "\n", |
| 288 | + "## FOR AGREEMENT\n", |
| 289 | + "\n", |
| 290 | + "* Authoritarian populist parties worldwide figured out how to weaponize trust and social media, winning elections.\n", |
| 291 | + " 86% of everyone who voted on statement 28 agreed.\n", |
| 292 | + "\n", |
| 293 | + "* We realized that information warfare is occurring by nonstate actors in destabilizing the international order\n", |
| 294 | + " 80% of everyone who voted on statement 20 agreed.\n", |
| 295 | + "\n", |
| 296 | + "* 2018 has been marked by the troubling rise of authoritarian leaders around the world.\n", |
| 297 | + " 88% of everyone who voted on statement 39 agreed.\n", |
| 298 | + "\n", |
| 299 | + "* The conversation about ethical uses of technology has reached a tipping point. Citizens, businesses and governments are on it, but baffled.\n", |
| 300 | + " 77% of everyone who voted on statement 27 agreed.\n", |
| 301 | + "\n", |
| 302 | + "* 2018 was the year Americans stopped thinking Silicon Valley was “different” or distinct from Wall St or the military industrial complex\n", |
| 303 | + " 74% of everyone who voted on statement 23 agreed.\n", |
| 304 | + "\n", |
| 305 | + "## FOR DISAGREEMENT\n", |
| 306 | + "\n", |
| 307 | + "None.\n", |
| 308 | + "\n", |
| 309 | + "\n", |
| 310 | + "# GROUP-REPRESENTATIVE STATEMENTS\n", |
| 311 | + "\n", |
| 312 | + "## GROUP A\n", |
| 313 | + "\n", |
291 | 314 | "* Major regulatory interference in the operation of Facebook's algorithms and policies is now definitely going to happen, in the USA.\n",
|
292 | 315 | " 100% of those in group A who voted on statement 11 agreed.\n",
|
293 | 316 | "\n",
|
|
304 | 327 | " 100% of those in group A who voted on statement 15 disagreed.\n",
|
305 | 328 | "\n",
|
306 | 329 | "\n",
|
307 |
| - "GROUP B\n", |
| 330 | + "## GROUP B\n", |
| 331 | + "\n", |
308 | 332 | "* Swing Left's campaign in waiting: building grassroots donors and volunteers during the primary, ready to go for the winning candidate.\n",
|
309 | 333 | " 55% of those in group B who voted on statement 38 agreed.\n",
|
310 | 334 | "\n",
|
311 | 335 | "\n",
|
312 |
| - "GROUP C\n", |
| 336 | + "## GROUP C\n", |
| 337 | + "\n", |
313 | 338 | "* Cyber-security is still not taken seriously enough by most people in the politics-tech world.\n",
|
314 | 339 | " 100% of those in group C who voted on statement 5 agreed.\n",
|
315 | 340 | "\n",
|
|
326 | 351 | " 70% of those in group C who voted on statement 14 disagreed.\n",
|
327 | 352 | "\n",
|
328 | 353 | "\n",
|
329 |
| - "GROUP D\n", |
| 354 | + "## GROUP D\n", |
| 355 | + "\n", |
330 | 356 | "* Facebook implementing local news and local government alerts directly into its product\n",
|
331 | 357 | " 85% of those in group D who voted on statement 15 agreed.\n",
|
332 | 358 | "\n",
|
|
343 | 369 | " 80% of those in group D who voted on statement 34 agreed.\n",
|
344 | 370 | "\n",
|
345 | 371 | "\n",
|
346 |
| - "GROUP E\n", |
| 372 | + "## GROUP E\n", |
| 373 | + "\n", |
347 | 374 | "* The realisation that the Republicans are now just as good at the parts of Digital comms that actually influence elections as the Democrats\n",
|
348 | 375 | " 83% of those in group E who voted on statement 16 agreed.\n",
|
349 | 376 | "\n",
|
|
0 commit comments