egrace479 commited on
Commit
0c71296
·
1 Parent(s): cf83d94

One last check on unknowns, these will now be weeded out in statistics.csv generation.

Browse files
Files changed (1) hide show
  1. notebooks/ToL_EDA.ipynb +322 -4
notebooks/ToL_EDA.ipynb CHANGED
@@ -22,7 +22,7 @@
22
  "name": "stderr",
23
  "output_type": "stream",
24
  "text": [
25
- "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_65691/3694103411.py:1: DtypeWarning: Columns (4,5,6) have mixed types. Specify dtype option on import or set low_memory=False.\n",
26
  " df = pd.read_csv(\"../data/v1-dev-names.csv\")\n"
27
  ]
28
  }
@@ -345,6 +345,325 @@
345
  "`Metazoa` and `Animalia` overlap, as do `Archaeplastida` and `Plantae`. They are sometimes used interchangably, though the former of each is a newer (more refined?) designation. Later we'll see this distinction cuts is by our data sources."
346
  ]
347
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  {
349
  "cell_type": "code",
350
  "execution_count": 4,
@@ -3792,7 +4111,7 @@
3792
  ],
3793
  "metadata": {
3794
  "kernelspec": {
3795
- "display_name": "venv",
3796
  "language": "python",
3797
  "name": "python3"
3798
  },
@@ -3807,8 +4126,7 @@
3807
  "nbconvert_exporter": "python",
3808
  "pygments_lexer": "ipython3",
3809
  "version": "3.11.3"
3810
- },
3811
- "orig_nbformat": 4
3812
  },
3813
  "nbformat": 4,
3814
  "nbformat_minor": 2
 
22
  "name": "stderr",
23
  "output_type": "stream",
24
  "text": [
25
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_88978/3694103411.py:1: DtypeWarning: Columns (4,5,6) have mixed types. Specify dtype option on import or set low_memory=False.\n",
26
  " df = pd.read_csv(\"../data/v1-dev-names.csv\")\n"
27
  ]
28
  }
 
345
  "`Metazoa` and `Animalia` overlap, as do `Archaeplastida` and `Plantae`. They are sometimes used interchangably, though the former of each is a newer (more refined?) designation. Later we'll see this distinction cuts is by our data sources."
346
  ]
347
  },
348
+ {
349
+ "cell_type": "markdown",
350
+ "metadata": {},
351
+ "source": [
352
+ "One more oddity to note: we have about 84K images with genus labeled \"UNKNOWN\"."
353
+ ]
354
+ },
355
+ {
356
+ "cell_type": "code",
357
+ "execution_count": 3,
358
+ "metadata": {},
359
+ "outputs": [
360
+ {
361
+ "name": "stdout",
362
+ "output_type": "stream",
363
+ "text": [
364
+ "<class 'pandas.core.frame.DataFrame'>\n",
365
+ "Index: 84025 entries, 30 to 10436423\n",
366
+ "Data columns (total 16 columns):\n",
367
+ " # Column Non-Null Count Dtype \n",
368
+ "--- ------ -------------- ----- \n",
369
+ " 0 treeoflife_id 84025 non-null object \n",
370
+ " 1 eol_content_id 84025 non-null float64\n",
371
+ " 2 eol_page_id 84025 non-null float64\n",
372
+ " 3 bioscan_part 0 non-null float64\n",
373
+ " 4 bioscan_filename 0 non-null object \n",
374
+ " 5 inat21_filename 0 non-null object \n",
375
+ " 6 inat21_cls_name 0 non-null object \n",
376
+ " 7 inat21_cls_num 0 non-null float64\n",
377
+ " 8 kingdom 0 non-null object \n",
378
+ " 9 phylum 0 non-null object \n",
379
+ " 10 class 0 non-null object \n",
380
+ " 11 order 0 non-null object \n",
381
+ " 12 family 0 non-null object \n",
382
+ " 13 genus 84025 non-null object \n",
383
+ " 14 species 7 non-null object \n",
384
+ " 15 common 84025 non-null object \n",
385
+ "dtypes: float64(4), object(12)\n",
386
+ "memory usage: 10.9+ MB\n"
387
+ ]
388
+ }
389
+ ],
390
+ "source": [
391
+ "df.loc[df.genus.str.lower() == \"unknown\"].info(show_counts = True)"
392
+ ]
393
+ },
394
+ {
395
+ "cell_type": "markdown",
396
+ "metadata": {},
397
+ "source": [
398
+ "Check in on the few non-null species values."
399
+ ]
400
+ },
401
+ {
402
+ "cell_type": "code",
403
+ "execution_count": 4,
404
+ "metadata": {
405
+ "scrolled": true
406
+ },
407
+ "outputs": [
408
+ {
409
+ "data": {
410
+ "text/html": [
411
+ "<div>\n",
412
+ "<style scoped>\n",
413
+ " .dataframe tbody tr th:only-of-type {\n",
414
+ " vertical-align: middle;\n",
415
+ " }\n",
416
+ "\n",
417
+ " .dataframe tbody tr th {\n",
418
+ " vertical-align: top;\n",
419
+ " }\n",
420
+ "\n",
421
+ " .dataframe thead th {\n",
422
+ " text-align: right;\n",
423
+ " }\n",
424
+ "</style>\n",
425
+ "<table border=\"1\" class=\"dataframe\">\n",
426
+ " <thead>\n",
427
+ " <tr style=\"text-align: right;\">\n",
428
+ " <th></th>\n",
429
+ " <th>treeoflife_id</th>\n",
430
+ " <th>eol_content_id</th>\n",
431
+ " <th>eol_page_id</th>\n",
432
+ " <th>bioscan_part</th>\n",
433
+ " <th>bioscan_filename</th>\n",
434
+ " <th>inat21_filename</th>\n",
435
+ " <th>inat21_cls_name</th>\n",
436
+ " <th>inat21_cls_num</th>\n",
437
+ " <th>kingdom</th>\n",
438
+ " <th>phylum</th>\n",
439
+ " <th>class</th>\n",
440
+ " <th>order</th>\n",
441
+ " <th>family</th>\n",
442
+ " <th>genus</th>\n",
443
+ " <th>species</th>\n",
444
+ " <th>common</th>\n",
445
+ " </tr>\n",
446
+ " </thead>\n",
447
+ " <tbody>\n",
448
+ " <tr>\n",
449
+ " <th>302277</th>\n",
450
+ " <td>1295e061-064b-4616-a10f-4a546489eb1a</td>\n",
451
+ " <td>14046024.0</td>\n",
452
+ " <td>62660090.0</td>\n",
453
+ " <td>NaN</td>\n",
454
+ " <td>NaN</td>\n",
455
+ " <td>NaN</td>\n",
456
+ " <td>NaN</td>\n",
457
+ " <td>NaN</td>\n",
458
+ " <td>NaN</td>\n",
459
+ " <td>NaN</td>\n",
460
+ " <td>NaN</td>\n",
461
+ " <td>NaN</td>\n",
462
+ " <td>NaN</td>\n",
463
+ " <td>Unknown</td>\n",
464
+ " <td>pleasehelp</td>\n",
465
+ " <td>Unknown pleasehelp</td>\n",
466
+ " </tr>\n",
467
+ " <tr>\n",
468
+ " <th>662535</th>\n",
469
+ " <td>79159008-2108-4690-a9b2-9812e0247ea5</td>\n",
470
+ " <td>14046023.0</td>\n",
471
+ " <td>62660090.0</td>\n",
472
+ " <td>NaN</td>\n",
473
+ " <td>NaN</td>\n",
474
+ " <td>NaN</td>\n",
475
+ " <td>NaN</td>\n",
476
+ " <td>NaN</td>\n",
477
+ " <td>NaN</td>\n",
478
+ " <td>NaN</td>\n",
479
+ " <td>NaN</td>\n",
480
+ " <td>NaN</td>\n",
481
+ " <td>NaN</td>\n",
482
+ " <td>Unknown</td>\n",
483
+ " <td>pleasehelp</td>\n",
484
+ " <td>Unknown pleasehelp</td>\n",
485
+ " </tr>\n",
486
+ " <tr>\n",
487
+ " <th>1133612</th>\n",
488
+ " <td>08614858-7836-4543-a33c-0432b85d8455</td>\n",
489
+ " <td>14046025.0</td>\n",
490
+ " <td>62660090.0</td>\n",
491
+ " <td>NaN</td>\n",
492
+ " <td>NaN</td>\n",
493
+ " <td>NaN</td>\n",
494
+ " <td>NaN</td>\n",
495
+ " <td>NaN</td>\n",
496
+ " <td>NaN</td>\n",
497
+ " <td>NaN</td>\n",
498
+ " <td>NaN</td>\n",
499
+ " <td>NaN</td>\n",
500
+ " <td>NaN</td>\n",
501
+ " <td>Unknown</td>\n",
502
+ " <td>pleasehelp</td>\n",
503
+ " <td>Unknown pleasehelp</td>\n",
504
+ " </tr>\n",
505
+ " <tr>\n",
506
+ " <th>1490749</th>\n",
507
+ " <td>73076cbf-3e79-427b-b0cb-5ba45386bb60</td>\n",
508
+ " <td>14046026.0</td>\n",
509
+ " <td>62660090.0</td>\n",
510
+ " <td>NaN</td>\n",
511
+ " <td>NaN</td>\n",
512
+ " <td>NaN</td>\n",
513
+ " <td>NaN</td>\n",
514
+ " <td>NaN</td>\n",
515
+ " <td>NaN</td>\n",
516
+ " <td>NaN</td>\n",
517
+ " <td>NaN</td>\n",
518
+ " <td>NaN</td>\n",
519
+ " <td>NaN</td>\n",
520
+ " <td>Unknown</td>\n",
521
+ " <td>pleasehelp</td>\n",
522
+ " <td>Unknown pleasehelp</td>\n",
523
+ " </tr>\n",
524
+ " <tr>\n",
525
+ " <th>3686711</th>\n",
526
+ " <td>79212ef1-bf62-4e1f-b983-4fb6d4bd6523</td>\n",
527
+ " <td>14046028.0</td>\n",
528
+ " <td>62660090.0</td>\n",
529
+ " <td>NaN</td>\n",
530
+ " <td>NaN</td>\n",
531
+ " <td>NaN</td>\n",
532
+ " <td>NaN</td>\n",
533
+ " <td>NaN</td>\n",
534
+ " <td>NaN</td>\n",
535
+ " <td>NaN</td>\n",
536
+ " <td>NaN</td>\n",
537
+ " <td>NaN</td>\n",
538
+ " <td>NaN</td>\n",
539
+ " <td>Unknown</td>\n",
540
+ " <td>pleasehelp</td>\n",
541
+ " <td>Unknown pleasehelp</td>\n",
542
+ " </tr>\n",
543
+ " <tr>\n",
544
+ " <th>4036030</th>\n",
545
+ " <td>1aeaf888-130b-4606-b9c6-f16bbcbbb68f</td>\n",
546
+ " <td>14046027.0</td>\n",
547
+ " <td>62660090.0</td>\n",
548
+ " <td>NaN</td>\n",
549
+ " <td>NaN</td>\n",
550
+ " <td>NaN</td>\n",
551
+ " <td>NaN</td>\n",
552
+ " <td>NaN</td>\n",
553
+ " <td>NaN</td>\n",
554
+ " <td>NaN</td>\n",
555
+ " <td>NaN</td>\n",
556
+ " <td>NaN</td>\n",
557
+ " <td>NaN</td>\n",
558
+ " <td>Unknown</td>\n",
559
+ " <td>pleasehelp</td>\n",
560
+ " <td>Unknown pleasehelp</td>\n",
561
+ " </tr>\n",
562
+ " <tr>\n",
563
+ " <th>4526299</th>\n",
564
+ " <td>be856027-d6c7-4321-b0d3-a155ad5b49ba</td>\n",
565
+ " <td>14046029.0</td>\n",
566
+ " <td>62660090.0</td>\n",
567
+ " <td>NaN</td>\n",
568
+ " <td>NaN</td>\n",
569
+ " <td>NaN</td>\n",
570
+ " <td>NaN</td>\n",
571
+ " <td>NaN</td>\n",
572
+ " <td>NaN</td>\n",
573
+ " <td>NaN</td>\n",
574
+ " <td>NaN</td>\n",
575
+ " <td>NaN</td>\n",
576
+ " <td>NaN</td>\n",
577
+ " <td>Unknown</td>\n",
578
+ " <td>pleasehelp</td>\n",
579
+ " <td>Unknown pleasehelp</td>\n",
580
+ " </tr>\n",
581
+ " </tbody>\n",
582
+ "</table>\n",
583
+ "</div>"
584
+ ],
585
+ "text/plain": [
586
+ " treeoflife_id eol_content_id eol_page_id \n",
587
+ "302277 1295e061-064b-4616-a10f-4a546489eb1a 14046024.0 62660090.0 \\\n",
588
+ "662535 79159008-2108-4690-a9b2-9812e0247ea5 14046023.0 62660090.0 \n",
589
+ "1133612 08614858-7836-4543-a33c-0432b85d8455 14046025.0 62660090.0 \n",
590
+ "1490749 73076cbf-3e79-427b-b0cb-5ba45386bb60 14046026.0 62660090.0 \n",
591
+ "3686711 79212ef1-bf62-4e1f-b983-4fb6d4bd6523 14046028.0 62660090.0 \n",
592
+ "4036030 1aeaf888-130b-4606-b9c6-f16bbcbbb68f 14046027.0 62660090.0 \n",
593
+ "4526299 be856027-d6c7-4321-b0d3-a155ad5b49ba 14046029.0 62660090.0 \n",
594
+ "\n",
595
+ " bioscan_part bioscan_filename inat21_filename inat21_cls_name \n",
596
+ "302277 NaN NaN NaN NaN \\\n",
597
+ "662535 NaN NaN NaN NaN \n",
598
+ "1133612 NaN NaN NaN NaN \n",
599
+ "1490749 NaN NaN NaN NaN \n",
600
+ "3686711 NaN NaN NaN NaN \n",
601
+ "4036030 NaN NaN NaN NaN \n",
602
+ "4526299 NaN NaN NaN NaN \n",
603
+ "\n",
604
+ " inat21_cls_num kingdom phylum class order family genus \n",
605
+ "302277 NaN NaN NaN NaN NaN NaN Unknown \\\n",
606
+ "662535 NaN NaN NaN NaN NaN NaN Unknown \n",
607
+ "1133612 NaN NaN NaN NaN NaN NaN Unknown \n",
608
+ "1490749 NaN NaN NaN NaN NaN NaN Unknown \n",
609
+ "3686711 NaN NaN NaN NaN NaN NaN Unknown \n",
610
+ "4036030 NaN NaN NaN NaN NaN NaN Unknown \n",
611
+ "4526299 NaN NaN NaN NaN NaN NaN Unknown \n",
612
+ "\n",
613
+ " species common \n",
614
+ "302277 pleasehelp Unknown pleasehelp \n",
615
+ "662535 pleasehelp Unknown pleasehelp \n",
616
+ "1133612 pleasehelp Unknown pleasehelp \n",
617
+ "1490749 pleasehelp Unknown pleasehelp \n",
618
+ "3686711 pleasehelp Unknown pleasehelp \n",
619
+ "4036030 pleasehelp Unknown pleasehelp \n",
620
+ "4526299 pleasehelp Unknown pleasehelp "
621
+ ]
622
+ },
623
+ "execution_count": 4,
624
+ "metadata": {},
625
+ "output_type": "execute_result"
626
+ }
627
+ ],
628
+ "source": [
629
+ "df_unknown_genus = df.loc[df.genus.str.lower() == \"unknown\"]\n",
630
+ "df_unknown_genus.loc[df_unknown_genus.species.notna()]"
631
+ ]
632
+ },
633
+ {
634
+ "cell_type": "markdown",
635
+ "metadata": {},
636
+ "source": [
637
+ "Would be interesting to see what the model thinks of these once we re-train. They're all some kind of blue dragonfly-like bug ([eol page](https://eol.org/pages/62660090/media))."
638
+ ]
639
+ },
640
+ {
641
+ "cell_type": "code",
642
+ "execution_count": 5,
643
+ "metadata": {},
644
+ "outputs": [
645
+ {
646
+ "data": {
647
+ "text/plain": [
648
+ "7"
649
+ ]
650
+ },
651
+ "execution_count": 5,
652
+ "metadata": {},
653
+ "output_type": "execute_result"
654
+ }
655
+ ],
656
+ "source": [
657
+ "len(df.loc[df.species.str.lower() == \"pleasehelp\"])"
658
+ ]
659
+ },
660
+ {
661
+ "cell_type": "markdown",
662
+ "metadata": {},
663
+ "source": [
664
+ "Good only these 7."
665
+ ]
666
+ },
667
  {
668
  "cell_type": "code",
669
  "execution_count": 4,
 
4111
  ],
4112
  "metadata": {
4113
  "kernelspec": {
4114
+ "display_name": "Python 3 (ipykernel)",
4115
  "language": "python",
4116
  "name": "python3"
4117
  },
 
4126
  "nbconvert_exporter": "python",
4127
  "pygments_lexer": "ipython3",
4128
  "version": "3.11.3"
4129
+ }
 
4130
  },
4131
  "nbformat": 4,
4132
  "nbformat_minor": 2