v3.3 Dataset Diversity Overlap Analysis
#6
by
egrace479 - opened
- notebooks/ToL_catalog_EDA.ipynb +209 -16
- notebooks/ToL_catalog_EDA.py +39 -1
notebooks/ToL_catalog_EDA.ipynb
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
"name": "stderr",
|
| 23 |
"output_type": "stream",
|
| 24 |
"text": [
|
| 25 |
-
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/
|
| 26 |
" df = pd.read_csv(\"../data/catalog.csv\")\n"
|
| 27 |
]
|
| 28 |
}
|
|
@@ -269,7 +269,7 @@
|
|
| 269 |
},
|
| 270 |
{
|
| 271 |
"cell_type": "code",
|
| 272 |
-
"execution_count":
|
| 273 |
"metadata": {},
|
| 274 |
"outputs": [],
|
| 275 |
"source": [
|
|
@@ -278,7 +278,7 @@
|
|
| 278 |
},
|
| 279 |
{
|
| 280 |
"cell_type": "code",
|
| 281 |
-
"execution_count":
|
| 282 |
"metadata": {},
|
| 283 |
"outputs": [
|
| 284 |
{
|
|
@@ -431,7 +431,7 @@
|
|
| 431 |
},
|
| 432 |
{
|
| 433 |
"cell_type": "code",
|
| 434 |
-
"execution_count":
|
| 435 |
"metadata": {},
|
| 436 |
"outputs": [
|
| 437 |
{
|
|
@@ -440,7 +440,7 @@
|
|
| 440 |
"['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']"
|
| 441 |
]
|
| 442 |
},
|
| 443 |
-
"execution_count":
|
| 444 |
"metadata": {},
|
| 445 |
"output_type": "execute_result"
|
| 446 |
}
|
|
@@ -459,7 +459,7 @@
|
|
| 459 |
},
|
| 460 |
{
|
| 461 |
"cell_type": "code",
|
| 462 |
-
"execution_count":
|
| 463 |
"metadata": {},
|
| 464 |
"outputs": [
|
| 465 |
{
|
|
@@ -735,7 +735,7 @@
|
|
| 735 |
},
|
| 736 |
{
|
| 737 |
"cell_type": "code",
|
| 738 |
-
"execution_count":
|
| 739 |
"metadata": {},
|
| 740 |
"outputs": [],
|
| 741 |
"source": [
|
|
@@ -784,7 +784,7 @@
|
|
| 784 |
},
|
| 785 |
{
|
| 786 |
"cell_type": "code",
|
| 787 |
-
"execution_count":
|
| 788 |
"metadata": {},
|
| 789 |
"outputs": [
|
| 790 |
{
|
|
@@ -793,7 +793,7 @@
|
|
| 793 |
"439910"
|
| 794 |
]
|
| 795 |
},
|
| 796 |
-
"execution_count":
|
| 797 |
"metadata": {},
|
| 798 |
"output_type": "execute_result"
|
| 799 |
}
|
|
@@ -804,7 +804,7 @@
|
|
| 804 |
},
|
| 805 |
{
|
| 806 |
"cell_type": "code",
|
| 807 |
-
"execution_count":
|
| 808 |
"metadata": {},
|
| 809 |
"outputs": [
|
| 810 |
{
|
|
@@ -813,7 +813,7 @@
|
|
| 813 |
"9947"
|
| 814 |
]
|
| 815 |
},
|
| 816 |
-
"execution_count":
|
| 817 |
"metadata": {},
|
| 818 |
"output_type": "execute_result"
|
| 819 |
}
|
|
@@ -824,7 +824,7 @@
|
|
| 824 |
},
|
| 825 |
{
|
| 826 |
"cell_type": "code",
|
| 827 |
-
"execution_count":
|
| 828 |
"metadata": {},
|
| 829 |
"outputs": [
|
| 830 |
{
|
|
@@ -833,7 +833,7 @@
|
|
| 833 |
"7758"
|
| 834 |
]
|
| 835 |
},
|
| 836 |
-
"execution_count":
|
| 837 |
"metadata": {},
|
| 838 |
"output_type": "execute_result"
|
| 839 |
}
|
|
@@ -862,7 +862,7 @@
|
|
| 862 |
},
|
| 863 |
{
|
| 864 |
"cell_type": "code",
|
| 865 |
-
"execution_count":
|
| 866 |
"metadata": {},
|
| 867 |
"outputs": [],
|
| 868 |
"source": [
|
|
@@ -1007,7 +1007,7 @@
|
|
| 1007 |
},
|
| 1008 |
{
|
| 1009 |
"cell_type": "code",
|
| 1010 |
-
"execution_count":
|
| 1011 |
"metadata": {},
|
| 1012 |
"outputs": [],
|
| 1013 |
"source": [
|
|
@@ -3641,6 +3641,13 @@
|
|
| 3641 |
"That's a good number of images, so unlikely to be the cause."
|
| 3642 |
]
|
| 3643 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3644 |
{
|
| 3645 |
"cell_type": "markdown",
|
| 3646 |
"metadata": {},
|
|
@@ -3710,11 +3717,197 @@
|
|
| 3710 |
"cell_type": "markdown",
|
| 3711 |
"metadata": {},
|
| 3712 |
"source": [
|
| 3713 |
-
"BIOSCAN and iNat21's overlap of genera is completely contained in EOL.\n",
|
| 3714 |
"\n",
|
| 3715 |
"No changes here."
|
| 3716 |
]
|
| 3717 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3718 |
{
|
| 3719 |
"cell_type": "markdown",
|
| 3720 |
"metadata": {},
|
|
|
|
| 22 |
"name": "stderr",
|
| 23 |
"output_type": "stream",
|
| 24 |
"text": [
|
| 25 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_11858/2566980770.py:1: DtypeWarning: Columns (5,6,7) have mixed types. Specify dtype option on import or set low_memory=False.\n",
|
| 26 |
" df = pd.read_csv(\"../data/catalog.csv\")\n"
|
| 27 |
]
|
| 28 |
}
|
|
|
|
| 269 |
},
|
| 270 |
{
|
| 271 |
"cell_type": "code",
|
| 272 |
+
"execution_count": 3,
|
| 273 |
"metadata": {},
|
| 274 |
"outputs": [],
|
| 275 |
"source": [
|
|
|
|
| 278 |
},
|
| 279 |
{
|
| 280 |
"cell_type": "code",
|
| 281 |
+
"execution_count": 4,
|
| 282 |
"metadata": {},
|
| 283 |
"outputs": [
|
| 284 |
{
|
|
|
|
| 431 |
},
|
| 432 |
{
|
| 433 |
"cell_type": "code",
|
| 434 |
+
"execution_count": 5,
|
| 435 |
"metadata": {},
|
| 436 |
"outputs": [
|
| 437 |
{
|
|
|
|
| 440 |
"['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']"
|
| 441 |
]
|
| 442 |
},
|
| 443 |
+
"execution_count": 5,
|
| 444 |
"metadata": {},
|
| 445 |
"output_type": "execute_result"
|
| 446 |
}
|
|
|
|
| 459 |
},
|
| 460 |
{
|
| 461 |
"cell_type": "code",
|
| 462 |
+
"execution_count": 6,
|
| 463 |
"metadata": {},
|
| 464 |
"outputs": [
|
| 465 |
{
|
|
|
|
| 735 |
},
|
| 736 |
{
|
| 737 |
"cell_type": "code",
|
| 738 |
+
"execution_count": 7,
|
| 739 |
"metadata": {},
|
| 740 |
"outputs": [],
|
| 741 |
"source": [
|
|
|
|
| 784 |
},
|
| 785 |
{
|
| 786 |
"cell_type": "code",
|
| 787 |
+
"execution_count": 8,
|
| 788 |
"metadata": {},
|
| 789 |
"outputs": [
|
| 790 |
{
|
|
|
|
| 793 |
"439910"
|
| 794 |
]
|
| 795 |
},
|
| 796 |
+
"execution_count": 8,
|
| 797 |
"metadata": {},
|
| 798 |
"output_type": "execute_result"
|
| 799 |
}
|
|
|
|
| 804 |
},
|
| 805 |
{
|
| 806 |
"cell_type": "code",
|
| 807 |
+
"execution_count": 9,
|
| 808 |
"metadata": {},
|
| 809 |
"outputs": [
|
| 810 |
{
|
|
|
|
| 813 |
"9947"
|
| 814 |
]
|
| 815 |
},
|
| 816 |
+
"execution_count": 9,
|
| 817 |
"metadata": {},
|
| 818 |
"output_type": "execute_result"
|
| 819 |
}
|
|
|
|
| 824 |
},
|
| 825 |
{
|
| 826 |
"cell_type": "code",
|
| 827 |
+
"execution_count": 10,
|
| 828 |
"metadata": {},
|
| 829 |
"outputs": [
|
| 830 |
{
|
|
|
|
| 833 |
"7758"
|
| 834 |
]
|
| 835 |
},
|
| 836 |
+
"execution_count": 10,
|
| 837 |
"metadata": {},
|
| 838 |
"output_type": "execute_result"
|
| 839 |
}
|
|
|
|
| 862 |
},
|
| 863 |
{
|
| 864 |
"cell_type": "code",
|
| 865 |
+
"execution_count": 11,
|
| 866 |
"metadata": {},
|
| 867 |
"outputs": [],
|
| 868 |
"source": [
|
|
|
|
| 1007 |
},
|
| 1008 |
{
|
| 1009 |
"cell_type": "code",
|
| 1010 |
+
"execution_count": 12,
|
| 1011 |
"metadata": {},
|
| 1012 |
"outputs": [],
|
| 1013 |
"source": [
|
|
|
|
| 3641 |
"That's a good number of images, so unlikely to be the cause."
|
| 3642 |
]
|
| 3643 |
},
|
| 3644 |
+
{
|
| 3645 |
+
"cell_type": "markdown",
|
| 3646 |
+
"metadata": {},
|
| 3647 |
+
"source": [
|
| 3648 |
+
"## Diversity Between Datasets"
|
| 3649 |
+
]
|
| 3650 |
+
},
|
| 3651 |
{
|
| 3652 |
"cell_type": "markdown",
|
| 3653 |
"metadata": {},
|
|
|
|
| 3717 |
"cell_type": "markdown",
|
| 3718 |
"metadata": {},
|
| 3719 |
"source": [
|
| 3720 |
+
"BIOSCAN and iNat21's overlap of genera is almost completely contained in EOL.\n",
|
| 3721 |
"\n",
|
| 3722 |
"No changes here."
|
| 3723 |
]
|
| 3724 |
},
|
| 3725 |
+
{
|
| 3726 |
+
"cell_type": "markdown",
|
| 3727 |
+
"metadata": {},
|
| 3728 |
+
"source": [
|
| 3729 |
+
"#### More thorough diversity check with 7-tuple taxa\n",
|
| 3730 |
+
"\n",
|
| 3731 |
+
"We'll first filter down to all unique 7-tuple taxa (by data source). Then, we'll reduce down to just EOL and iNat21 to determine how much EOL adds to iNat21's diversity. The remainder from the total is added by BIOSCAN."
|
| 3732 |
+
]
|
| 3733 |
+
},
|
| 3734 |
+
{
|
| 3735 |
+
"cell_type": "code",
|
| 3736 |
+
"execution_count": 13,
|
| 3737 |
+
"metadata": {},
|
| 3738 |
+
"outputs": [],
|
| 3739 |
+
"source": [
|
| 3740 |
+
"source_taxa = ['data_source', 'kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']"
|
| 3741 |
+
]
|
| 3742 |
+
},
|
| 3743 |
+
{
|
| 3744 |
+
"cell_type": "code",
|
| 3745 |
+
"execution_count": 14,
|
| 3746 |
+
"metadata": {},
|
| 3747 |
+
"outputs": [
|
| 3748 |
+
{
|
| 3749 |
+
"name": "stdout",
|
| 3750 |
+
"output_type": "stream",
|
| 3751 |
+
"text": [
|
| 3752 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 3753 |
+
"Index: 466741 entries, 956203 to 11000902\n",
|
| 3754 |
+
"Data columns (total 19 columns):\n",
|
| 3755 |
+
" # Column Non-Null Count Dtype \n",
|
| 3756 |
+
"--- ------ -------------- ----- \n",
|
| 3757 |
+
" 0 split 466741 non-null object \n",
|
| 3758 |
+
" 1 treeoflife_id 466741 non-null object \n",
|
| 3759 |
+
" 2 eol_content_id 448910 non-null float64\n",
|
| 3760 |
+
" 3 eol_page_id 448910 non-null float64\n",
|
| 3761 |
+
" 4 bioscan_part 7831 non-null float64\n",
|
| 3762 |
+
" 5 bioscan_filename 7831 non-null object \n",
|
| 3763 |
+
" 6 inat21_filename 10000 non-null object \n",
|
| 3764 |
+
" 7 inat21_cls_name 10000 non-null object \n",
|
| 3765 |
+
" 8 inat21_cls_num 10000 non-null float64\n",
|
| 3766 |
+
" 9 kingdom 437587 non-null object \n",
|
| 3767 |
+
" 10 phylum 438050 non-null object \n",
|
| 3768 |
+
" 11 class 436934 non-null object \n",
|
| 3769 |
+
" 12 order 437280 non-null object \n",
|
| 3770 |
+
" 13 family 437137 non-null object \n",
|
| 3771 |
+
" 14 genus 439711 non-null object \n",
|
| 3772 |
+
" 15 species 424855 non-null object \n",
|
| 3773 |
+
" 16 common 466741 non-null object \n",
|
| 3774 |
+
" 17 data_source 466741 non-null object \n",
|
| 3775 |
+
" 18 duplicate 466741 non-null bool \n",
|
| 3776 |
+
"dtypes: bool(1), float64(4), object(14)\n",
|
| 3777 |
+
"memory usage: 68.1+ MB\n"
|
| 3778 |
+
]
|
| 3779 |
+
}
|
| 3780 |
+
],
|
| 3781 |
+
"source": [
|
| 3782 |
+
"df['duplicate'] = df.duplicated(subset = source_taxa, keep = 'first')\n",
|
| 3783 |
+
"df_unique_taxa = df.loc[~df['duplicate']]\n",
|
| 3784 |
+
"df_unique_taxa.info(show_counts=True)"
|
| 3785 |
+
]
|
| 3786 |
+
},
|
| 3787 |
+
{
|
| 3788 |
+
"cell_type": "markdown",
|
| 3789 |
+
"metadata": {},
|
| 3790 |
+
"source": [
|
| 3791 |
+
"We have 466,741 unique taxa by source (i.e., the sum of unique 7-tuples within EOL, iNat21, and BIOSCAN, without considering overlaps between them). Our actual unique 7-tuple taxa count for the full dataset is 454,103, so we have about 12,600 taxa shared between our constituent parts.\n",
|
| 3792 |
+
"\n",
|
| 3793 |
+
"Now, let's reduce this down to just EOL and iNat21."
|
| 3794 |
+
]
|
| 3795 |
+
},
|
| 3796 |
+
{
|
| 3797 |
+
"cell_type": "code",
|
| 3798 |
+
"execution_count": 15,
|
| 3799 |
+
"metadata": {},
|
| 3800 |
+
"outputs": [
|
| 3801 |
+
{
|
| 3802 |
+
"name": "stdout",
|
| 3803 |
+
"output_type": "stream",
|
| 3804 |
+
"text": [
|
| 3805 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 3806 |
+
"Index: 458910 entries, 956203 to 11000902\n",
|
| 3807 |
+
"Data columns (total 19 columns):\n",
|
| 3808 |
+
" # Column Non-Null Count Dtype \n",
|
| 3809 |
+
"--- ------ -------------- ----- \n",
|
| 3810 |
+
" 0 split 458910 non-null object \n",
|
| 3811 |
+
" 1 treeoflife_id 458910 non-null object \n",
|
| 3812 |
+
" 2 eol_content_id 448910 non-null float64\n",
|
| 3813 |
+
" 3 eol_page_id 448910 non-null float64\n",
|
| 3814 |
+
" 4 bioscan_part 0 non-null float64\n",
|
| 3815 |
+
" 5 bioscan_filename 0 non-null object \n",
|
| 3816 |
+
" 6 inat21_filename 10000 non-null object \n",
|
| 3817 |
+
" 7 inat21_cls_name 10000 non-null object \n",
|
| 3818 |
+
" 8 inat21_cls_num 10000 non-null float64\n",
|
| 3819 |
+
" 9 kingdom 429756 non-null object \n",
|
| 3820 |
+
" 10 phylum 430219 non-null object \n",
|
| 3821 |
+
" 11 class 429103 non-null object \n",
|
| 3822 |
+
" 12 order 429449 non-null object \n",
|
| 3823 |
+
" 13 family 429320 non-null object \n",
|
| 3824 |
+
" 14 genus 432307 non-null object \n",
|
| 3825 |
+
" 15 species 419345 non-null object \n",
|
| 3826 |
+
" 16 common 458910 non-null object \n",
|
| 3827 |
+
" 17 data_source 458910 non-null object \n",
|
| 3828 |
+
" 18 duplicate 458910 non-null bool \n",
|
| 3829 |
+
"dtypes: bool(1), float64(4), object(14)\n",
|
| 3830 |
+
"memory usage: 67.0+ MB\n"
|
| 3831 |
+
]
|
| 3832 |
+
}
|
| 3833 |
+
],
|
| 3834 |
+
"source": [
|
| 3835 |
+
"df_taxa_Enat = df_unique_taxa.loc[df_unique_taxa.data_source != \"BIOSCAN\"]\n",
|
| 3836 |
+
"df_taxa_Enat.info(show_counts = True)"
|
| 3837 |
+
]
|
| 3838 |
+
},
|
| 3839 |
+
{
|
| 3840 |
+
"cell_type": "markdown",
|
| 3841 |
+
"metadata": {},
|
| 3842 |
+
"source": [
|
| 3843 |
+
"We have 458,910 for EOL and iNat21. Now, we remove taxa duplicates between the two datasets."
|
| 3844 |
+
]
|
| 3845 |
+
},
|
| 3846 |
+
{
|
| 3847 |
+
"cell_type": "code",
|
| 3848 |
+
"execution_count": 16,
|
| 3849 |
+
"metadata": {},
|
| 3850 |
+
"outputs": [
|
| 3851 |
+
{
|
| 3852 |
+
"name": "stdout",
|
| 3853 |
+
"output_type": "stream",
|
| 3854 |
+
"text": [
|
| 3855 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 3856 |
+
"Index: 450284 entries, 956203 to 11000902\n",
|
| 3857 |
+
"Data columns (total 19 columns):\n",
|
| 3858 |
+
" # Column Non-Null Count Dtype \n",
|
| 3859 |
+
"--- ------ -------------- ----- \n",
|
| 3860 |
+
" 0 split 450284 non-null object \n",
|
| 3861 |
+
" 1 treeoflife_id 450284 non-null object \n",
|
| 3862 |
+
" 2 eol_content_id 448492 non-null float64\n",
|
| 3863 |
+
" 3 eol_page_id 448492 non-null float64\n",
|
| 3864 |
+
" 4 bioscan_part 0 non-null float64\n",
|
| 3865 |
+
" 5 bioscan_filename 0 non-null object \n",
|
| 3866 |
+
" 6 inat21_filename 1792 non-null object \n",
|
| 3867 |
+
" 7 inat21_cls_name 1792 non-null object \n",
|
| 3868 |
+
" 8 inat21_cls_num 1792 non-null float64\n",
|
| 3869 |
+
" 9 kingdom 421130 non-null object \n",
|
| 3870 |
+
" 10 phylum 421593 non-null object \n",
|
| 3871 |
+
" 11 class 420477 non-null object \n",
|
| 3872 |
+
" 12 order 420823 non-null object \n",
|
| 3873 |
+
" 13 family 420694 non-null object \n",
|
| 3874 |
+
" 14 genus 423681 non-null object \n",
|
| 3875 |
+
" 15 species 410719 non-null object \n",
|
| 3876 |
+
" 16 common 450284 non-null object \n",
|
| 3877 |
+
" 17 data_source 450284 non-null object \n",
|
| 3878 |
+
" 18 duplicate 450284 non-null bool \n",
|
| 3879 |
+
"dtypes: bool(1), float64(4), object(14)\n",
|
| 3880 |
+
"memory usage: 65.7+ MB\n"
|
| 3881 |
+
]
|
| 3882 |
+
},
|
| 3883 |
+
{
|
| 3884 |
+
"name": "stderr",
|
| 3885 |
+
"output_type": "stream",
|
| 3886 |
+
"text": [
|
| 3887 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_11858/532979333.py:1: SettingWithCopyWarning: \n",
|
| 3888 |
+
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 3889 |
+
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 3890 |
+
"\n",
|
| 3891 |
+
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 3892 |
+
" df_taxa_Enat['duplicate'] = df_taxa_Enat.duplicated(subset = taxa, keep = 'first')\n"
|
| 3893 |
+
]
|
| 3894 |
+
}
|
| 3895 |
+
],
|
| 3896 |
+
"source": [
|
| 3897 |
+
"df_taxa_Enat['duplicate'] = df_taxa_Enat.duplicated(subset = taxa, keep = 'first')\n",
|
| 3898 |
+
"df_unique_taxa_Enat = df_taxa_Enat.loc[~df_taxa_Enat['duplicate']]\n",
|
| 3899 |
+
"df_unique_taxa_Enat.info(show_counts = True)"
|
| 3900 |
+
]
|
| 3901 |
+
},
|
| 3902 |
+
{
|
| 3903 |
+
"cell_type": "markdown",
|
| 3904 |
+
"metadata": {},
|
| 3905 |
+
"source": [
|
| 3906 |
+
"Between iNat21 and EOL we have 450,284 unique taxa. That means we have 3,819 unique 7-tuple taxa added by BIOSCAN, and there are 8,626 taxa (7-tuples) shared between EOL and iNat21 (86% of iNat21).\n",
|
| 3907 |
+
"\n",
|
| 3908 |
+
"EOL has 448,910 unique 7-tuple taxa, so it adds 440,284 more unique taxa to iNat21, then the addition of BIOSCAN adds another 3,819 unique taxa."
|
| 3909 |
+
]
|
| 3910 |
+
},
|
| 3911 |
{
|
| 3912 |
"cell_type": "markdown",
|
| 3913 |
"metadata": {},
|
notebooks/ToL_catalog_EDA.py
CHANGED
|
@@ -491,6 +491,9 @@ eol_long_all_taxa[taxa].info(show_counts = True)
|
|
| 491 |
# %% [markdown]
|
| 492 |
# That's a good number of images, so unlikely to be the cause.
|
| 493 |
|
|
|
|
|
|
|
|
|
|
| 494 |
# %% [markdown]
|
| 495 |
# ### Label Overlap Check
|
| 496 |
|
|
@@ -516,10 +519,45 @@ print(f"There are {len(list(set(inat21_genera) & set(bioscan_genera)))} genera s
|
|
| 516 |
print(f"There are {len(list(set(gen_overlap) & set(bioscan_genera)))} genera shared between all three data sources.")
|
| 517 |
|
| 518 |
# %% [markdown]
|
| 519 |
-
# BIOSCAN and iNat21's overlap of genera is completely contained in EOL.
|
| 520 |
#
|
| 521 |
# No changes here.
|
| 522 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 523 |
# %% [markdown]
|
| 524 |
# ## Overall Stats
|
| 525 |
#
|
|
|
|
| 491 |
# %% [markdown]
|
| 492 |
# That's a good number of images, so unlikely to be the cause.
|
| 493 |
|
| 494 |
+
# %% [markdown]
|
| 495 |
+
# ## Diversity Between Datasets
|
| 496 |
+
|
| 497 |
# %% [markdown]
|
| 498 |
# ### Label Overlap Check
|
| 499 |
|
|
|
|
| 519 |
print(f"There are {len(list(set(gen_overlap) & set(bioscan_genera)))} genera shared between all three data sources.")
|
| 520 |
|
| 521 |
# %% [markdown]
|
| 522 |
+
# BIOSCAN and iNat21's overlap of genera is almost completely contained in EOL.
|
| 523 |
#
|
| 524 |
# No changes here.
|
| 525 |
|
| 526 |
+
# %% [markdown]
|
| 527 |
+
# #### More thorough diversity check with 7-tuple taxa
|
| 528 |
+
#
|
| 529 |
+
# We'll first filter down to all unique 7-tuple taxa (by data source). Then, we'll reduce down to just EOL and iNat21 to determine how much EOL adds to iNat21's diversity. The remainder from the total is added by BIOSCAN.
|
| 530 |
+
|
| 531 |
+
# %%
|
| 532 |
+
source_taxa = ['data_source', 'kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']
|
| 533 |
+
|
| 534 |
+
# %%
|
| 535 |
+
df['duplicate'] = df.duplicated(subset = source_taxa, keep = 'first')
|
| 536 |
+
df_unique_taxa = df.loc[~df['duplicate']]
|
| 537 |
+
df_unique_taxa.info(show_counts=True)
|
| 538 |
+
|
| 539 |
+
# %% [markdown]
|
| 540 |
+
# We have 466,741 unique taxa by source (i.e., the sum of unique 7-tuples within EOL, iNat21, and BIOSCAN, without considering overlaps between them). Our actual unique 7-tuple taxa count for the full dataset is 454,103, so we have about 12,600 taxa shared between our constituent parts.
|
| 541 |
+
#
|
| 542 |
+
# Now, let's reduce this down to just EOL and iNat21.
|
| 543 |
+
|
| 544 |
+
# %%
|
| 545 |
+
df_taxa_Enat = df_unique_taxa.loc[df_unique_taxa.data_source != "BIOSCAN"]
|
| 546 |
+
df_taxa_Enat.info(show_counts = True)
|
| 547 |
+
|
| 548 |
+
# %% [markdown]
|
| 549 |
+
# We have 458,910 for EOL and iNat21. Now, we remove taxa duplicates between the two datasets.
|
| 550 |
+
|
| 551 |
+
# %%
|
| 552 |
+
df_taxa_Enat['duplicate'] = df_taxa_Enat.duplicated(subset = taxa, keep = 'first')
|
| 553 |
+
df_unique_taxa_Enat = df_taxa_Enat.loc[~df_taxa_Enat['duplicate']]
|
| 554 |
+
df_unique_taxa_Enat.info(show_counts = True)
|
| 555 |
+
|
| 556 |
+
# %% [markdown]
|
| 557 |
+
# Between iNat21 and EOL we have 450,284 unique taxa. That means we have 3,819 unique 7-tuple taxa added by BIOSCAN, and there are 8,626 taxa (7-tuples) shared between EOL and iNat21 (86% of iNat21).
|
| 558 |
+
#
|
| 559 |
+
# EOL has 448,910 unique 7-tuple taxa, so it adds 440,284 more unique taxa to iNat21, then the addition of BIOSCAN adds another 3,819 unique taxa.
|
| 560 |
+
|
| 561 |
# %% [markdown]
|
| 562 |
# ## Overall Stats
|
| 563 |
#
|