ibnummuhammad
commited on
Commit
•
c8bfad0
1
Parent(s):
023e070
Add penguin_binary_classification_v2.ipynb
Browse files
penguins_binary_classification_v2.ipynb
CHANGED
@@ -1494,7 +1494,7 @@
|
|
1494 |
},
|
1495 |
{
|
1496 |
"cell_type": "code",
|
1497 |
-
"execution_count":
|
1498 |
"metadata": {},
|
1499 |
"outputs": [
|
1500 |
{
|
@@ -1509,7 +1509,7 @@
|
|
1509 |
" 0, 0, 0, 1, 0])"
|
1510 |
]
|
1511 |
},
|
1512 |
-
"execution_count":
|
1513 |
"metadata": {},
|
1514 |
"output_type": "execute_result"
|
1515 |
}
|
@@ -1518,6 +1518,308 @@
|
|
1518 |
"log.predict(X_test)"
|
1519 |
]
|
1520 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1521 |
{
|
1522 |
"cell_type": "code",
|
1523 |
"execution_count": 15,
|
|
|
1494 |
},
|
1495 |
{
|
1496 |
"cell_type": "code",
|
1497 |
+
"execution_count": 53,
|
1498 |
"metadata": {},
|
1499 |
"outputs": [
|
1500 |
{
|
|
|
1509 |
" 0, 0, 0, 1, 0])"
|
1510 |
]
|
1511 |
},
|
1512 |
+
"execution_count": 53,
|
1513 |
"metadata": {},
|
1514 |
"output_type": "execute_result"
|
1515 |
}
|
|
|
1518 |
"log.predict(X_test)"
|
1519 |
]
|
1520 |
},
|
1521 |
+
{
|
1522 |
+
"cell_type": "code",
|
1523 |
+
"execution_count": 45,
|
1524 |
+
"metadata": {},
|
1525 |
+
"outputs": [
|
1526 |
+
{
|
1527 |
+
"data": {
|
1528 |
+
"text/plain": [
|
1529 |
+
"pandas.core.frame.DataFrame"
|
1530 |
+
]
|
1531 |
+
},
|
1532 |
+
"execution_count": 45,
|
1533 |
+
"metadata": {},
|
1534 |
+
"output_type": "execute_result"
|
1535 |
+
}
|
1536 |
+
],
|
1537 |
+
"source": [
|
1538 |
+
"type(df_dummy)"
|
1539 |
+
]
|
1540 |
+
},
|
1541 |
+
{
|
1542 |
+
"cell_type": "code",
|
1543 |
+
"execution_count": 38,
|
1544 |
+
"metadata": {},
|
1545 |
+
"outputs": [
|
1546 |
+
{
|
1547 |
+
"data": {
|
1548 |
+
"text/plain": [
|
1549 |
+
"bill_length_mm 36.6\n",
|
1550 |
+
"bill_depth_mm 18.4\n",
|
1551 |
+
"flipper_length_mm 184.0\n",
|
1552 |
+
"body_mass_g 3475.0\n",
|
1553 |
+
"year 2009.0\n",
|
1554 |
+
"species_Adelie 1.0\n",
|
1555 |
+
"species_Gentoo 0.0\n",
|
1556 |
+
"island_Biscoe 0.0\n",
|
1557 |
+
"island_Dream 1.0\n",
|
1558 |
+
"island_Torgersen 0.0\n",
|
1559 |
+
"Name: 146, dtype: float64"
|
1560 |
+
]
|
1561 |
+
},
|
1562 |
+
"execution_count": 38,
|
1563 |
+
"metadata": {},
|
1564 |
+
"output_type": "execute_result"
|
1565 |
+
}
|
1566 |
+
],
|
1567 |
+
"source": [
|
1568 |
+
"df_dummy.iloc[27]"
|
1569 |
+
]
|
1570 |
+
},
|
1571 |
+
{
|
1572 |
+
"cell_type": "code",
|
1573 |
+
"execution_count": 46,
|
1574 |
+
"metadata": {},
|
1575 |
+
"outputs": [
|
1576 |
+
{
|
1577 |
+
"data": {
|
1578 |
+
"text/plain": [
|
1579 |
+
"pandas.core.series.Series"
|
1580 |
+
]
|
1581 |
+
},
|
1582 |
+
"execution_count": 46,
|
1583 |
+
"metadata": {},
|
1584 |
+
"output_type": "execute_result"
|
1585 |
+
}
|
1586 |
+
],
|
1587 |
+
"source": [
|
1588 |
+
"type(df_dummy.iloc[27])"
|
1589 |
+
]
|
1590 |
+
},
|
1591 |
+
{
|
1592 |
+
"cell_type": "code",
|
1593 |
+
"execution_count": 43,
|
1594 |
+
"metadata": {},
|
1595 |
+
"outputs": [
|
1596 |
+
{
|
1597 |
+
"data": {
|
1598 |
+
"text/plain": [
|
1599 |
+
"bill_length_mm 36.6\n",
|
1600 |
+
"bill_depth_mm 18.4\n",
|
1601 |
+
"flipper_length_mm 184.0\n",
|
1602 |
+
"body_mass_g 3475.0\n",
|
1603 |
+
"Name: 146, dtype: float64"
|
1604 |
+
]
|
1605 |
+
},
|
1606 |
+
"execution_count": 43,
|
1607 |
+
"metadata": {},
|
1608 |
+
"output_type": "execute_result"
|
1609 |
+
}
|
1610 |
+
],
|
1611 |
+
"source": [
|
1612 |
+
"df_dummy[[\"bill_length_mm\", \"bill_depth_mm\", \"flipper_length_mm\", \"body_mass_g\"]].iloc[27]"
|
1613 |
+
]
|
1614 |
+
},
|
1615 |
+
{
|
1616 |
+
"cell_type": "code",
|
1617 |
+
"execution_count": 44,
|
1618 |
+
"metadata": {},
|
1619 |
+
"outputs": [
|
1620 |
+
{
|
1621 |
+
"data": {
|
1622 |
+
"text/plain": [
|
1623 |
+
"bill_length_mm 37.9\n",
|
1624 |
+
"bill_depth_mm 18.6\n",
|
1625 |
+
"flipper_length_mm 172.0\n",
|
1626 |
+
"body_mass_g 3150.0\n",
|
1627 |
+
"Name: 27, dtype: float64"
|
1628 |
+
]
|
1629 |
+
},
|
1630 |
+
"execution_count": 44,
|
1631 |
+
"metadata": {},
|
1632 |
+
"output_type": "execute_result"
|
1633 |
+
}
|
1634 |
+
],
|
1635 |
+
"source": [
|
1636 |
+
"df_dummy[[\"bill_length_mm\", \"bill_depth_mm\", \"flipper_length_mm\", \"body_mass_g\"]].loc[27]"
|
1637 |
+
]
|
1638 |
+
},
|
1639 |
+
{
|
1640 |
+
"cell_type": "code",
|
1641 |
+
"execution_count": 83,
|
1642 |
+
"metadata": {},
|
1643 |
+
"outputs": [],
|
1644 |
+
"source": [
|
1645 |
+
"index = 250"
|
1646 |
+
]
|
1647 |
+
},
|
1648 |
+
{
|
1649 |
+
"cell_type": "code",
|
1650 |
+
"execution_count": 84,
|
1651 |
+
"metadata": {},
|
1652 |
+
"outputs": [
|
1653 |
+
{
|
1654 |
+
"data": {
|
1655 |
+
"text/html": [
|
1656 |
+
"<div>\n",
|
1657 |
+
"<style scoped>\n",
|
1658 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
1659 |
+
" vertical-align: middle;\n",
|
1660 |
+
" }\n",
|
1661 |
+
"\n",
|
1662 |
+
" .dataframe tbody tr th {\n",
|
1663 |
+
" vertical-align: top;\n",
|
1664 |
+
" }\n",
|
1665 |
+
"\n",
|
1666 |
+
" .dataframe thead th {\n",
|
1667 |
+
" text-align: right;\n",
|
1668 |
+
" }\n",
|
1669 |
+
"</style>\n",
|
1670 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1671 |
+
" <thead>\n",
|
1672 |
+
" <tr style=\"text-align: right;\">\n",
|
1673 |
+
" <th></th>\n",
|
1674 |
+
" <th>bill_length_mm</th>\n",
|
1675 |
+
" <th>bill_depth_mm</th>\n",
|
1676 |
+
" <th>flipper_length_mm</th>\n",
|
1677 |
+
" <th>body_mass_g</th>\n",
|
1678 |
+
" <th>year</th>\n",
|
1679 |
+
" <th>species_Adelie</th>\n",
|
1680 |
+
" <th>species_Gentoo</th>\n",
|
1681 |
+
" <th>island_Biscoe</th>\n",
|
1682 |
+
" <th>island_Dream</th>\n",
|
1683 |
+
" <th>island_Torgersen</th>\n",
|
1684 |
+
" </tr>\n",
|
1685 |
+
" </thead>\n",
|
1686 |
+
" <tbody>\n",
|
1687 |
+
" <tr>\n",
|
1688 |
+
" <th>250</th>\n",
|
1689 |
+
" <td>51.1</td>\n",
|
1690 |
+
" <td>16.5</td>\n",
|
1691 |
+
" <td>225.0</td>\n",
|
1692 |
+
" <td>5250.0</td>\n",
|
1693 |
+
" <td>2009</td>\n",
|
1694 |
+
" <td>0</td>\n",
|
1695 |
+
" <td>1</td>\n",
|
1696 |
+
" <td>1</td>\n",
|
1697 |
+
" <td>0</td>\n",
|
1698 |
+
" <td>0</td>\n",
|
1699 |
+
" </tr>\n",
|
1700 |
+
" </tbody>\n",
|
1701 |
+
"</table>\n",
|
1702 |
+
"</div>"
|
1703 |
+
],
|
1704 |
+
"text/plain": [
|
1705 |
+
" bill_length_mm bill_depth_mm flipper_length_mm body_mass_g year \\\n",
|
1706 |
+
"250 51.1 16.5 225.0 5250.0 2009 \n",
|
1707 |
+
"\n",
|
1708 |
+
" species_Adelie species_Gentoo island_Biscoe island_Dream \\\n",
|
1709 |
+
"250 0 1 1 0 \n",
|
1710 |
+
"\n",
|
1711 |
+
" island_Torgersen \n",
|
1712 |
+
"250 0 "
|
1713 |
+
]
|
1714 |
+
},
|
1715 |
+
"execution_count": 84,
|
1716 |
+
"metadata": {},
|
1717 |
+
"output_type": "execute_result"
|
1718 |
+
}
|
1719 |
+
],
|
1720 |
+
"source": [
|
1721 |
+
"df_dummy.filter(items=[index], axis=0)"
|
1722 |
+
]
|
1723 |
+
},
|
1724 |
+
{
|
1725 |
+
"cell_type": "code",
|
1726 |
+
"execution_count": 85,
|
1727 |
+
"metadata": {},
|
1728 |
+
"outputs": [
|
1729 |
+
{
|
1730 |
+
"data": {
|
1731 |
+
"text/html": [
|
1732 |
+
"<div>\n",
|
1733 |
+
"<style scoped>\n",
|
1734 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
1735 |
+
" vertical-align: middle;\n",
|
1736 |
+
" }\n",
|
1737 |
+
"\n",
|
1738 |
+
" .dataframe tbody tr th {\n",
|
1739 |
+
" vertical-align: top;\n",
|
1740 |
+
" }\n",
|
1741 |
+
"\n",
|
1742 |
+
" .dataframe thead th {\n",
|
1743 |
+
" text-align: right;\n",
|
1744 |
+
" }\n",
|
1745 |
+
"</style>\n",
|
1746 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1747 |
+
" <thead>\n",
|
1748 |
+
" <tr style=\"text-align: right;\">\n",
|
1749 |
+
" <th></th>\n",
|
1750 |
+
" <th>bill_length_mm</th>\n",
|
1751 |
+
" <th>bill_depth_mm</th>\n",
|
1752 |
+
" <th>flipper_length_mm</th>\n",
|
1753 |
+
" <th>body_mass_g</th>\n",
|
1754 |
+
" </tr>\n",
|
1755 |
+
" </thead>\n",
|
1756 |
+
" <tbody>\n",
|
1757 |
+
" <tr>\n",
|
1758 |
+
" <th>250</th>\n",
|
1759 |
+
" <td>51.1</td>\n",
|
1760 |
+
" <td>16.5</td>\n",
|
1761 |
+
" <td>225.0</td>\n",
|
1762 |
+
" <td>5250.0</td>\n",
|
1763 |
+
" </tr>\n",
|
1764 |
+
" </tbody>\n",
|
1765 |
+
"</table>\n",
|
1766 |
+
"</div>"
|
1767 |
+
],
|
1768 |
+
"text/plain": [
|
1769 |
+
" bill_length_mm bill_depth_mm flipper_length_mm body_mass_g\n",
|
1770 |
+
"250 51.1 16.5 225.0 5250.0"
|
1771 |
+
]
|
1772 |
+
},
|
1773 |
+
"execution_count": 85,
|
1774 |
+
"metadata": {},
|
1775 |
+
"output_type": "execute_result"
|
1776 |
+
}
|
1777 |
+
],
|
1778 |
+
"source": [
|
1779 |
+
"df_dummy.filter(items=[index], axis=0)[[\"bill_length_mm\", \"bill_depth_mm\", \"flipper_length_mm\", \"body_mass_g\"]]"
|
1780 |
+
]
|
1781 |
+
},
|
1782 |
+
{
|
1783 |
+
"cell_type": "code",
|
1784 |
+
"execution_count": 86,
|
1785 |
+
"metadata": {},
|
1786 |
+
"outputs": [
|
1787 |
+
{
|
1788 |
+
"data": {
|
1789 |
+
"text/plain": [
|
1790 |
+
"250 1\n",
|
1791 |
+
"Name: species_Gentoo, dtype: int64"
|
1792 |
+
]
|
1793 |
+
},
|
1794 |
+
"execution_count": 86,
|
1795 |
+
"metadata": {},
|
1796 |
+
"output_type": "execute_result"
|
1797 |
+
}
|
1798 |
+
],
|
1799 |
+
"source": [
|
1800 |
+
"df_dummy.filter(items=[index], axis=0)[\"species_Gentoo\"]"
|
1801 |
+
]
|
1802 |
+
},
|
1803 |
+
{
|
1804 |
+
"cell_type": "code",
|
1805 |
+
"execution_count": 87,
|
1806 |
+
"metadata": {},
|
1807 |
+
"outputs": [
|
1808 |
+
{
|
1809 |
+
"data": {
|
1810 |
+
"text/plain": [
|
1811 |
+
"array([1])"
|
1812 |
+
]
|
1813 |
+
},
|
1814 |
+
"execution_count": 87,
|
1815 |
+
"metadata": {},
|
1816 |
+
"output_type": "execute_result"
|
1817 |
+
}
|
1818 |
+
],
|
1819 |
+
"source": [
|
1820 |
+
"log.predict(df_dummy.filter(items=[index], axis=0)[[\"bill_length_mm\", \"bill_depth_mm\", \"flipper_length_mm\", \"body_mass_g\"]])"
|
1821 |
+
]
|
1822 |
+
},
|
1823 |
{
|
1824 |
"cell_type": "code",
|
1825 |
"execution_count": 15,
|