Added count of unique 7-tuples and genus-species pairs.
Browse files- notebooks/ToL_catalog_EDA.ipynb +121 -0
- notebooks/ToL_catalog_EDA.py +22 -0
notebooks/ToL_catalog_EDA.ipynb
CHANGED
|
@@ -499,6 +499,127 @@
|
|
| 499 |
"We're at 8.4M+ entries with full taxonomic labels, so that's really good, especially considering 1,043,863 of the BIOSCAN sourced images don't have species labels."
|
| 500 |
]
|
| 501 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
{
|
| 503 |
"cell_type": "markdown",
|
| 504 |
"metadata": {},
|
|
|
|
| 499 |
"We're at 8.4M+ entries with full taxonomic labels, so that's really good, especially considering 1,043,863 of the BIOSCAN sourced images don't have species labels."
|
| 500 |
]
|
| 501 |
},
|
| 502 |
+
{
|
| 503 |
+
"cell_type": "markdown",
|
| 504 |
+
"metadata": {},
|
| 505 |
+
"source": [
|
| 506 |
+
"How about number of unique 7-tuples?"
|
| 507 |
+
]
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"cell_type": "code",
|
| 511 |
+
"execution_count": 66,
|
| 512 |
+
"metadata": {},
|
| 513 |
+
"outputs": [],
|
| 514 |
+
"source": [
|
| 515 |
+
"#number of unique 7-tuples in full dataset\n",
|
| 516 |
+
"df['duplicate'] = df.duplicated(subset = taxa, keep = 'first')\n",
|
| 517 |
+
"df_unique_taxa = df.loc[~df['duplicate']]"
|
| 518 |
+
]
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"cell_type": "code",
|
| 522 |
+
"execution_count": 67,
|
| 523 |
+
"metadata": {},
|
| 524 |
+
"outputs": [
|
| 525 |
+
{
|
| 526 |
+
"name": "stdout",
|
| 527 |
+
"output_type": "stream",
|
| 528 |
+
"text": [
|
| 529 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 530 |
+
"Index: 454103 entries, 956203 to 11000902\n",
|
| 531 |
+
"Data columns (total 19 columns):\n",
|
| 532 |
+
" # Column Non-Null Count Dtype \n",
|
| 533 |
+
"--- ------ -------------- ----- \n",
|
| 534 |
+
" 0 split 454103 non-null object \n",
|
| 535 |
+
" 1 treeoflife_id 454103 non-null object \n",
|
| 536 |
+
" 2 eol_content_id 446988 non-null float64\n",
|
| 537 |
+
" 3 eol_page_id 446988 non-null float64\n",
|
| 538 |
+
" 4 bioscan_part 5328 non-null float64\n",
|
| 539 |
+
" 5 bioscan_filename 5328 non-null object \n",
|
| 540 |
+
" 6 inat21_filename 1787 non-null object \n",
|
| 541 |
+
" 7 inat21_cls_name 1787 non-null object \n",
|
| 542 |
+
" 8 inat21_cls_num 1787 non-null float64\n",
|
| 543 |
+
" 9 kingdom 424949 non-null object \n",
|
| 544 |
+
" 10 phylum 425412 non-null object \n",
|
| 545 |
+
" 11 class 424296 non-null object \n",
|
| 546 |
+
" 12 order 424642 non-null object \n",
|
| 547 |
+
" 13 family 424513 non-null object \n",
|
| 548 |
+
" 14 genus 427476 non-null object \n",
|
| 549 |
+
" 15 species 414061 non-null object \n",
|
| 550 |
+
" 16 common 454103 non-null object \n",
|
| 551 |
+
" 17 data_source 454103 non-null object \n",
|
| 552 |
+
" 18 duplicate 454103 non-null bool \n",
|
| 553 |
+
"dtypes: bool(1), float64(4), object(14)\n",
|
| 554 |
+
"memory usage: 66.3+ MB\n"
|
| 555 |
+
]
|
| 556 |
+
}
|
| 557 |
+
],
|
| 558 |
+
"source": [
|
| 559 |
+
"df_unique_taxa.info(show_counts = True)"
|
| 560 |
+
]
|
| 561 |
+
},
|
| 562 |
+
{
|
| 563 |
+
"cell_type": "markdown",
|
| 564 |
+
"metadata": {},
|
| 565 |
+
"source": [
|
| 566 |
+
"And number of unique `genus-species` pairs?"
|
| 567 |
+
]
|
| 568 |
+
},
|
| 569 |
+
{
|
| 570 |
+
"cell_type": "code",
|
| 571 |
+
"execution_count": 68,
|
| 572 |
+
"metadata": {},
|
| 573 |
+
"outputs": [],
|
| 574 |
+
"source": [
|
| 575 |
+
"#number of unique genus-species pairs in full dataset\n",
|
| 576 |
+
"df['sciName-duplicate'] = df.duplicated(subset = ['genus', 'species'], keep = 'first')\n",
|
| 577 |
+
"df_unique_sciName = df.loc[~df['sciName-duplicate']]"
|
| 578 |
+
]
|
| 579 |
+
},
|
| 580 |
+
{
|
| 581 |
+
"cell_type": "code",
|
| 582 |
+
"execution_count": 69,
|
| 583 |
+
"metadata": {},
|
| 584 |
+
"outputs": [
|
| 585 |
+
{
|
| 586 |
+
"name": "stdout",
|
| 587 |
+
"output_type": "stream",
|
| 588 |
+
"text": [
|
| 589 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 590 |
+
"Index: 447462 entries, 956203 to 11000902\n",
|
| 591 |
+
"Data columns (total 20 columns):\n",
|
| 592 |
+
" # Column Non-Null Count Dtype \n",
|
| 593 |
+
"--- ------ -------------- ----- \n",
|
| 594 |
+
" 0 split 447462 non-null object \n",
|
| 595 |
+
" 1 treeoflife_id 447462 non-null object \n",
|
| 596 |
+
" 2 eol_content_id 441554 non-null float64\n",
|
| 597 |
+
" 3 eol_page_id 441554 non-null float64\n",
|
| 598 |
+
" 4 bioscan_part 5085 non-null float64\n",
|
| 599 |
+
" 5 bioscan_filename 5085 non-null object \n",
|
| 600 |
+
" 6 inat21_filename 823 non-null object \n",
|
| 601 |
+
" 7 inat21_cls_name 823 non-null object \n",
|
| 602 |
+
" 8 inat21_cls_num 823 non-null float64\n",
|
| 603 |
+
" 9 kingdom 418488 non-null object \n",
|
| 604 |
+
" 10 phylum 418888 non-null object \n",
|
| 605 |
+
" 11 class 417965 non-null object \n",
|
| 606 |
+
" 12 order 418287 non-null object \n",
|
| 607 |
+
" 13 family 418677 non-null object \n",
|
| 608 |
+
" 14 genus 425770 non-null object \n",
|
| 609 |
+
" 15 species 412555 non-null object \n",
|
| 610 |
+
" 16 common 447462 non-null object \n",
|
| 611 |
+
" 17 data_source 447462 non-null object \n",
|
| 612 |
+
" 18 duplicate 447462 non-null bool \n",
|
| 613 |
+
" 19 sciName-duplicate 447462 non-null bool \n",
|
| 614 |
+
"dtypes: bool(2), float64(4), object(14)\n",
|
| 615 |
+
"memory usage: 65.7+ MB\n"
|
| 616 |
+
]
|
| 617 |
+
}
|
| 618 |
+
],
|
| 619 |
+
"source": [
|
| 620 |
+
"df_unique_sciName.info(show_counts = True)"
|
| 621 |
+
]
|
| 622 |
+
},
|
| 623 |
{
|
| 624 |
"cell_type": "markdown",
|
| 625 |
"metadata": {},
|
notebooks/ToL_catalog_EDA.py
CHANGED
|
@@ -85,6 +85,28 @@ df_all_taxa[taxa].info(show_counts = True)
|
|
| 85 |
#
|
| 86 |
# We're at 8.4M+ entries with full taxonomic labels, so that's really good, especially considering 1,043,863 of the BIOSCAN sourced images don't have species labels.
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
# %% [markdown]
|
| 89 |
# More detail on these missing values from [`check_taxa` script](https://github.com/Imageomics/open_clip/blob/main/scripts/evobio10m/check_taxa.py) are displayed below. Note: full record of taxa check output is in `data/missing_taxa_output.txt`.
|
| 90 |
#
|
|
|
|
| 85 |
#
|
| 86 |
# We're at 8.4M+ entries with full taxonomic labels, so that's really good, especially considering 1,043,863 of the BIOSCAN sourced images don't have species labels.
|
| 87 |
|
| 88 |
+
# %% [markdown]
|
| 89 |
+
# How about number of unique 7-tuples?
|
| 90 |
+
|
| 91 |
+
# %%
|
| 92 |
+
#number of unique 7-tuples in full dataset
|
| 93 |
+
df['duplicate'] = df.duplicated(subset = taxa, keep = 'first')
|
| 94 |
+
df_unique_taxa = df.loc[~df['duplicate']]
|
| 95 |
+
|
| 96 |
+
# %%
|
| 97 |
+
df_unique_taxa.info(show_counts = True)
|
| 98 |
+
|
| 99 |
+
# %% [markdown]
|
| 100 |
+
# And number of unique `genus-species` pairs?
|
| 101 |
+
|
| 102 |
+
# %%
|
| 103 |
+
#number of unique genus-species pairs in full dataset
|
| 104 |
+
df['sciName-duplicate'] = df.duplicated(subset = ['genus', 'species'], keep = 'first')
|
| 105 |
+
df_unique_sciName = df.loc[~df['sciName-duplicate']]
|
| 106 |
+
|
| 107 |
+
# %%
|
| 108 |
+
df_unique_sciName.info(show_counts = True)
|
| 109 |
+
|
| 110 |
# %% [markdown]
|
| 111 |
# More detail on these missing values from [`check_taxa` script](https://github.com/Imageomics/open_clip/blob/main/scripts/evobio10m/check_taxa.py) are displayed below. Note: full record of taxa check output is in `data/missing_taxa_output.txt`.
|
| 112 |
#
|