{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Custom Dataset" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example, we will load a dataset from `scikit-learn` and use it to create a custom `Dataset` object in _Olympus_." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "from olympus import Dataset" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# load the boston dataset from sklearn\n", "from sklearn.datasets import load_boston\n", "boston = load_boston()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | CRIM | \n", "ZN | \n", "INDUS | \n", "CHAS | \n", "NOX | \n", "RM | \n", "AGE | \n", "DIS | \n", "RAD | \n", "TAX | \n", "PTRATIO | \n", "B | \n", "LSTAT | \n", "target | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0.00632 | \n", "18.0 | \n", "2.31 | \n", "0.0 | \n", "0.538 | \n", "6.575 | \n", "65.2 | \n", "4.0900 | \n", "1.0 | \n", "296.0 | \n", "15.3 | \n", "396.90 | \n", "4.98 | \n", "24.0 | \n", "
1 | \n", "0.02731 | \n", "0.0 | \n", "7.07 | \n", "0.0 | \n", "0.469 | \n", "6.421 | \n", "78.9 | \n", "4.9671 | \n", "2.0 | \n", "242.0 | \n", "17.8 | \n", "396.90 | \n", "9.14 | \n", "21.6 | \n", "
2 | \n", "0.02729 | \n", "0.0 | \n", "7.07 | \n", "0.0 | \n", "0.469 | \n", "7.185 | \n", "61.1 | \n", "4.9671 | \n", "2.0 | \n", "242.0 | \n", "17.8 | \n", "392.83 | \n", "4.03 | \n", "34.7 | \n", "
3 | \n", "0.03237 | \n", "0.0 | \n", "2.18 | \n", "0.0 | \n", "0.458 | \n", "6.998 | \n", "45.8 | \n", "6.0622 | \n", "3.0 | \n", "222.0 | \n", "18.7 | \n", "394.63 | \n", "2.94 | \n", "33.4 | \n", "
4 | \n", "0.06905 | \n", "0.0 | \n", "2.18 | \n", "0.0 | \n", "0.458 | \n", "7.147 | \n", "54.2 | \n", "6.0622 | \n", "3.0 | \n", "222.0 | \n", "18.7 | \n", "396.90 | \n", "5.33 | \n", "36.2 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
501 | \n", "0.06263 | \n", "0.0 | \n", "11.93 | \n", "0.0 | \n", "0.573 | \n", "6.593 | \n", "69.1 | \n", "2.4786 | \n", "1.0 | \n", "273.0 | \n", "21.0 | \n", "391.99 | \n", "9.67 | \n", "22.4 | \n", "
502 | \n", "0.04527 | \n", "0.0 | \n", "11.93 | \n", "0.0 | \n", "0.573 | \n", "6.120 | \n", "76.7 | \n", "2.2875 | \n", "1.0 | \n", "273.0 | \n", "21.0 | \n", "396.90 | \n", "9.08 | \n", "20.6 | \n", "
503 | \n", "0.06076 | \n", "0.0 | \n", "11.93 | \n", "0.0 | \n", "0.573 | \n", "6.976 | \n", "91.0 | \n", "2.1675 | \n", "1.0 | \n", "273.0 | \n", "21.0 | \n", "396.90 | \n", "5.64 | \n", "23.9 | \n", "
504 | \n", "0.10959 | \n", "0.0 | \n", "11.93 | \n", "0.0 | \n", "0.573 | \n", "6.794 | \n", "89.3 | \n", "2.3889 | \n", "1.0 | \n", "273.0 | \n", "21.0 | \n", "393.45 | \n", "6.48 | \n", "22.0 | \n", "
505 | \n", "0.04741 | \n", "0.0 | \n", "11.93 | \n", "0.0 | \n", "0.573 | \n", "6.030 | \n", "80.8 | \n", "2.5050 | \n", "1.0 | \n", "273.0 | \n", "21.0 | \n", "396.90 | \n", "7.88 | \n", "11.9 | \n", "
506 rows × 14 columns
\n", "