mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-02-02 13:07:51 +01:00
Use OrdinalEncoder and OneHotEncoder from Scikit-Learn 0.20 instead of CategoricalEncoder
This commit is contained in:
@@ -790,7 +790,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"housing_cat = housing['ocean_proximity']\n",
|
||||
"housing_cat = housing[['ocean_proximity']]\n",
|
||||
"housing_cat.head(10)"
|
||||
]
|
||||
},
|
||||
@@ -798,7 +798,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We can use Pandas' `factorize()` method to convert this string categorical feature to an integer categorical feature, which will be easier for Machine Learning algorithms to handle:"
|
||||
"**Warning**: earlier versions of the book used the `LabelEncoder` class or Pandas' `Series.factorize()` method instead of the `OrdinalEncoder` class (available since Scikit-Learn 0.20). It is preferable to use the `OrdinalEncoder` class, since it is designed for input features (instead of labels) and it plays well with pipelines, as we will see later in this notebook. Similarly, earlier version of the book used the `LabelBinarizer` class or the `CategoricalEncoder` class for one-hot encoding (which we will look at shortly), but since Scikit-Learn 0.20 it is preferable to use the `OneHotEncoder` class. If you are using an older version of Scikit-Learn, please consider upgrading (in case you want to stick to an old version of Scikit-Learn, the new `OrdinalEncoder` and `OneHotEncoder` classes are provided in the `future_encoders.py` file)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -807,8 +807,10 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"housing_cat_encoded, housing_categories = housing_cat.factorize()\n",
|
||||
"housing_cat_encoded[:10]"
|
||||
"try:\n",
|
||||
" from sklearn.preprocessing import OrdinalEncoder, OneHotEncoder\n",
|
||||
"except ImportError:\n",
|
||||
" from future_encoders import OrdinalEncoder, OneHotEncoder"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -817,21 +819,9 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"housing_categories"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Warning**: earlier versions of the book used the `LabelEncoder` class instead of Pandas' `factorize()` method. This was incorrect: indeed, as its name suggests, the `LabelEncoder` class was designed for labels, not for input features. The code worked because we were handling a single categorical input feature, but it would break if you passed multiple categorical input features."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We can convert each categorical value to a one-hot vector using a `OneHotEncoder`:"
|
||||
"ordinal_encoder = OrdinalEncoder()\n",
|
||||
"housing_cat_encoded = ordinal_encoder.fit_transform(housing_cat)\n",
|
||||
"housing_cat_encoded[:10]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -840,18 +830,14 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.preprocessing import OneHotEncoder\n",
|
||||
"\n",
|
||||
"encoder = OneHotEncoder()\n",
|
||||
"housing_cat_1hot = encoder.fit_transform(housing_cat_encoded.reshape(-1,1))\n",
|
||||
"housing_cat_1hot"
|
||||
"ordinal_encoder.categories_"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The `OneHotEncoder` returns a sparse array by default, but we can convert it to a dense array if needed:"
|
||||
"We can convert each categorical value to a one-hot vector using a `OneHotEncoder`. Prior to Scikit-Learn 0.20, this class could only handle integer categorical inputs. Now it can also handle string categorical inputs:"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -860,14 +846,16 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"housing_cat_1hot.toarray()"
|
||||
"cat_encoder = OneHotEncoder()\n",
|
||||
"housing_cat_1hot = cat_encoder.fit_transform(housing_cat)\n",
|
||||
"housing_cat_1hot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Warning**: earlier versions of the book used the `LabelBinarizer` class at this point. Again, this was incorrect: just like the `LabelEncoder` class, the `LabelBinarizer` class was designed to preprocess labels, not input features. A better solution is to use Scikit-Learn's upcoming `CategoricalEncoder` class: it will soon be added to Scikit-Learn, and in the meantime you can use the code below (copied from [Pull Request #9151](https://github.com/scikit-learn/scikit-learn/pull/9151))."
|
||||
"By default, the `OneHotEncoder` class returns a sparse array, but we can convert it to a dense array if needed by calling the `toarray()` method:"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -876,199 +864,14 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Definition of the CategoricalEncoder class, copied from PR #9151.\n",
|
||||
"# Just run this cell, or copy it to your code, do not try to understand it (yet).\n",
|
||||
"\n",
|
||||
"from sklearn.base import BaseEstimator, TransformerMixin\n",
|
||||
"from sklearn.utils import check_array\n",
|
||||
"from sklearn.preprocessing import LabelEncoder\n",
|
||||
"from scipy import sparse\n",
|
||||
"\n",
|
||||
"class CategoricalEncoder(BaseEstimator, TransformerMixin):\n",
|
||||
" \"\"\"Encode categorical features as a numeric array.\n",
|
||||
" The input to this transformer should be a matrix of integers or strings,\n",
|
||||
" denoting the values taken on by categorical (discrete) features.\n",
|
||||
" The features can be encoded using a one-hot aka one-of-K scheme\n",
|
||||
" (``encoding='onehot'``, the default) or converted to ordinal integers\n",
|
||||
" (``encoding='ordinal'``).\n",
|
||||
" This encoding is needed for feeding categorical data to many scikit-learn\n",
|
||||
" estimators, notably linear models and SVMs with the standard kernels.\n",
|
||||
" Read more in the :ref:`User Guide <preprocessing_categorical_features>`.\n",
|
||||
" Parameters\n",
|
||||
" ----------\n",
|
||||
" encoding : str, 'onehot', 'onehot-dense' or 'ordinal'\n",
|
||||
" The type of encoding to use (default is 'onehot'):\n",
|
||||
" - 'onehot': encode the features using a one-hot aka one-of-K scheme\n",
|
||||
" (or also called 'dummy' encoding). This creates a binary column for\n",
|
||||
" each category and returns a sparse matrix.\n",
|
||||
" - 'onehot-dense': the same as 'onehot' but returns a dense array\n",
|
||||
" instead of a sparse matrix.\n",
|
||||
" - 'ordinal': encode the features as ordinal integers. This results in\n",
|
||||
" a single column of integers (0 to n_categories - 1) per feature.\n",
|
||||
" categories : 'auto' or a list of lists/arrays of values.\n",
|
||||
" Categories (unique values) per feature:\n",
|
||||
" - 'auto' : Determine categories automatically from the training data.\n",
|
||||
" - list : ``categories[i]`` holds the categories expected in the ith\n",
|
||||
" column. The passed categories are sorted before encoding the data\n",
|
||||
" (used categories can be found in the ``categories_`` attribute).\n",
|
||||
" dtype : number type, default np.float64\n",
|
||||
" Desired dtype of output.\n",
|
||||
" handle_unknown : 'error' (default) or 'ignore'\n",
|
||||
" Whether to raise an error or ignore if a unknown categorical feature is\n",
|
||||
" present during transform (default is to raise). When this is parameter\n",
|
||||
" is set to 'ignore' and an unknown category is encountered during\n",
|
||||
" transform, the resulting one-hot encoded columns for this feature\n",
|
||||
" will be all zeros.\n",
|
||||
" Ignoring unknown categories is not supported for\n",
|
||||
" ``encoding='ordinal'``.\n",
|
||||
" Attributes\n",
|
||||
" ----------\n",
|
||||
" categories_ : list of arrays\n",
|
||||
" The categories of each feature determined during fitting. When\n",
|
||||
" categories were specified manually, this holds the sorted categories\n",
|
||||
" (in order corresponding with output of `transform`).\n",
|
||||
" Examples\n",
|
||||
" --------\n",
|
||||
" Given a dataset with three features and two samples, we let the encoder\n",
|
||||
" find the maximum value per feature and transform the data to a binary\n",
|
||||
" one-hot encoding.\n",
|
||||
" >>> from sklearn.preprocessing import CategoricalEncoder\n",
|
||||
" >>> enc = CategoricalEncoder(handle_unknown='ignore')\n",
|
||||
" >>> enc.fit([[0, 0, 3], [1, 1, 0], [0, 2, 1], [1, 0, 2]])\n",
|
||||
" ... # doctest: +ELLIPSIS\n",
|
||||
" CategoricalEncoder(categories='auto', dtype=<... 'numpy.float64'>,\n",
|
||||
" encoding='onehot', handle_unknown='ignore')\n",
|
||||
" >>> enc.transform([[0, 1, 1], [1, 0, 4]]).toarray()\n",
|
||||
" array([[ 1., 0., 0., 1., 0., 0., 1., 0., 0.],\n",
|
||||
" [ 0., 1., 1., 0., 0., 0., 0., 0., 0.]])\n",
|
||||
" See also\n",
|
||||
" --------\n",
|
||||
" sklearn.preprocessing.OneHotEncoder : performs a one-hot encoding of\n",
|
||||
" integer ordinal features. The ``OneHotEncoder assumes`` that input\n",
|
||||
" features take on values in the range ``[0, max(feature)]`` instead of\n",
|
||||
" using the unique values.\n",
|
||||
" sklearn.feature_extraction.DictVectorizer : performs a one-hot encoding of\n",
|
||||
" dictionary items (also handles string-valued features).\n",
|
||||
" sklearn.feature_extraction.FeatureHasher : performs an approximate one-hot\n",
|
||||
" encoding of dictionary items or strings.\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" def __init__(self, encoding='onehot', categories='auto', dtype=np.float64,\n",
|
||||
" handle_unknown='error'):\n",
|
||||
" self.encoding = encoding\n",
|
||||
" self.categories = categories\n",
|
||||
" self.dtype = dtype\n",
|
||||
" self.handle_unknown = handle_unknown\n",
|
||||
"\n",
|
||||
" def fit(self, X, y=None):\n",
|
||||
" \"\"\"Fit the CategoricalEncoder to X.\n",
|
||||
" Parameters\n",
|
||||
" ----------\n",
|
||||
" X : array-like, shape [n_samples, n_feature]\n",
|
||||
" The data to determine the categories of each feature.\n",
|
||||
" Returns\n",
|
||||
" -------\n",
|
||||
" self\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" if self.encoding not in ['onehot', 'onehot-dense', 'ordinal']:\n",
|
||||
" template = (\"encoding should be either 'onehot', 'onehot-dense' \"\n",
|
||||
" \"or 'ordinal', got %s\")\n",
|
||||
" raise ValueError(template % self.handle_unknown)\n",
|
||||
"\n",
|
||||
" if self.handle_unknown not in ['error', 'ignore']:\n",
|
||||
" template = (\"handle_unknown should be either 'error' or \"\n",
|
||||
" \"'ignore', got %s\")\n",
|
||||
" raise ValueError(template % self.handle_unknown)\n",
|
||||
"\n",
|
||||
" if self.encoding == 'ordinal' and self.handle_unknown == 'ignore':\n",
|
||||
" raise ValueError(\"handle_unknown='ignore' is not supported for\"\n",
|
||||
" \" encoding='ordinal'\")\n",
|
||||
"\n",
|
||||
" X = check_array(X, dtype=np.object, accept_sparse='csc', copy=True)\n",
|
||||
" n_samples, n_features = X.shape\n",
|
||||
"\n",
|
||||
" self._label_encoders_ = [LabelEncoder() for _ in range(n_features)]\n",
|
||||
"\n",
|
||||
" for i in range(n_features):\n",
|
||||
" le = self._label_encoders_[i]\n",
|
||||
" Xi = X[:, i]\n",
|
||||
" if self.categories == 'auto':\n",
|
||||
" le.fit(Xi)\n",
|
||||
" else:\n",
|
||||
" valid_mask = np.in1d(Xi, self.categories[i])\n",
|
||||
" if not np.all(valid_mask):\n",
|
||||
" if self.handle_unknown == 'error':\n",
|
||||
" diff = np.unique(Xi[~valid_mask])\n",
|
||||
" msg = (\"Found unknown categories {0} in column {1}\"\n",
|
||||
" \" during fit\".format(diff, i))\n",
|
||||
" raise ValueError(msg)\n",
|
||||
" le.classes_ = np.array(np.sort(self.categories[i]))\n",
|
||||
"\n",
|
||||
" self.categories_ = [le.classes_ for le in self._label_encoders_]\n",
|
||||
"\n",
|
||||
" return self\n",
|
||||
"\n",
|
||||
" def transform(self, X):\n",
|
||||
" \"\"\"Transform X using one-hot encoding.\n",
|
||||
" Parameters\n",
|
||||
" ----------\n",
|
||||
" X : array-like, shape [n_samples, n_features]\n",
|
||||
" The data to encode.\n",
|
||||
" Returns\n",
|
||||
" -------\n",
|
||||
" X_out : sparse matrix or a 2-d array\n",
|
||||
" Transformed input.\n",
|
||||
" \"\"\"\n",
|
||||
" X = check_array(X, accept_sparse='csc', dtype=np.object, copy=True)\n",
|
||||
" n_samples, n_features = X.shape\n",
|
||||
" X_int = np.zeros_like(X, dtype=np.int)\n",
|
||||
" X_mask = np.ones_like(X, dtype=np.bool)\n",
|
||||
"\n",
|
||||
" for i in range(n_features):\n",
|
||||
" valid_mask = np.in1d(X[:, i], self.categories_[i])\n",
|
||||
"\n",
|
||||
" if not np.all(valid_mask):\n",
|
||||
" if self.handle_unknown == 'error':\n",
|
||||
" diff = np.unique(X[~valid_mask, i])\n",
|
||||
" msg = (\"Found unknown categories {0} in column {1}\"\n",
|
||||
" \" during transform\".format(diff, i))\n",
|
||||
" raise ValueError(msg)\n",
|
||||
" else:\n",
|
||||
" # Set the problematic rows to an acceptable value and\n",
|
||||
" # continue `The rows are marked `X_mask` and will be\n",
|
||||
" # removed later.\n",
|
||||
" X_mask[:, i] = valid_mask\n",
|
||||
" X[:, i][~valid_mask] = self.categories_[i][0]\n",
|
||||
" X_int[:, i] = self._label_encoders_[i].transform(X[:, i])\n",
|
||||
"\n",
|
||||
" if self.encoding == 'ordinal':\n",
|
||||
" return X_int.astype(self.dtype, copy=False)\n",
|
||||
"\n",
|
||||
" mask = X_mask.ravel()\n",
|
||||
" n_values = [cats.shape[0] for cats in self.categories_]\n",
|
||||
" n_values = np.array([0] + n_values)\n",
|
||||
" indices = np.cumsum(n_values)\n",
|
||||
"\n",
|
||||
" column_indices = (X_int + indices[:-1]).ravel()[mask]\n",
|
||||
" row_indices = np.repeat(np.arange(n_samples, dtype=np.int32),\n",
|
||||
" n_features)[mask]\n",
|
||||
" data = np.ones(n_samples * n_features)[mask]\n",
|
||||
"\n",
|
||||
" out = sparse.csc_matrix((data, (row_indices, column_indices)),\n",
|
||||
" shape=(n_samples, indices[-1]),\n",
|
||||
" dtype=self.dtype).tocsr()\n",
|
||||
" if self.encoding == 'onehot-dense':\n",
|
||||
" return out.toarray()\n",
|
||||
" else:\n",
|
||||
" return out"
|
||||
"housing_cat_1hot.toarray()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The `CategoricalEncoder` expects a 2D array containing one or more categorical input features. We need to reshape `housing_cat` to a 2D array:"
|
||||
"Alternatively, you can set `sparse=False` when creating the `OneHotEncoder`:"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1077,53 +880,16 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#from sklearn.preprocessing import CategoricalEncoder # in future versions of Scikit-Learn\n",
|
||||
"\n",
|
||||
"cat_encoder = CategoricalEncoder()\n",
|
||||
"housing_cat_reshaped = housing_cat.values.reshape(-1, 1)\n",
|
||||
"housing_cat_1hot = cat_encoder.fit_transform(housing_cat_reshaped)\n",
|
||||
"cat_encoder = OneHotEncoder(sparse=False)\n",
|
||||
"housing_cat_1hot = cat_encoder.fit_transform(housing_cat)\n",
|
||||
"housing_cat_1hot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The default encoding is one-hot, and it returns a sparse array. You can use `toarray()` to get a dense array:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 66,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"housing_cat_1hot.toarray()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Alternatively, you can specify the encoding to be `\"onehot-dense\"` to get a dense matrix rather than a sparse matrix:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 67,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"cat_encoder = CategoricalEncoder(encoding=\"onehot-dense\")\n",
|
||||
"housing_cat_1hot = cat_encoder.fit_transform(housing_cat_reshaped)\n",
|
||||
"housing_cat_1hot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 68,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"cat_encoder.categories_"
|
||||
]
|
||||
@@ -1137,7 +903,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 69,
|
||||
"execution_count": 67,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1167,11 +933,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 70,
|
||||
"execution_count": 68,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"housing_extra_attribs = pd.DataFrame(housing_extra_attribs, columns=list(housing.columns)+[\"rooms_per_household\", \"population_per_household\"])\n",
|
||||
"housing_extra_attribs = pd.DataFrame(\n",
|
||||
" housing_extra_attribs,\n",
|
||||
" columns=list(housing.columns)+[\"rooms_per_household\", \"population_per_household\"])\n",
|
||||
"housing_extra_attribs.head()"
|
||||
]
|
||||
},
|
||||
@@ -1184,7 +952,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 71,
|
||||
"execution_count": 69,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1202,7 +970,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 72,
|
||||
"execution_count": 70,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1218,7 +986,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 73,
|
||||
"execution_count": 71,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1244,7 +1012,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 74,
|
||||
"execution_count": 72,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1260,13 +1028,13 @@
|
||||
"\n",
|
||||
"cat_pipeline = Pipeline([\n",
|
||||
" ('selector', DataFrameSelector(cat_attribs)),\n",
|
||||
" ('cat_encoder', CategoricalEncoder(encoding=\"onehot-dense\")),\n",
|
||||
" ('cat_encoder', OneHotEncoder(sparse=False)),\n",
|
||||
" ])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 75,
|
||||
"execution_count": 73,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1280,7 +1048,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 76,
|
||||
"execution_count": 74,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1290,7 +1058,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 77,
|
||||
"execution_count": 75,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1306,7 +1074,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 78,
|
||||
"execution_count": 76,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1318,7 +1086,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 79,
|
||||
"execution_count": 77,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1339,7 +1107,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 80,
|
||||
"execution_count": 78,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1348,7 +1116,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 81,
|
||||
"execution_count": 79,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1357,7 +1125,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 82,
|
||||
"execution_count": 80,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1371,7 +1139,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 83,
|
||||
"execution_count": 81,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1383,7 +1151,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 84,
|
||||
"execution_count": 82,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1395,7 +1163,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 85,
|
||||
"execution_count": 83,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1414,7 +1182,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 86,
|
||||
"execution_count": 84,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1427,7 +1195,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 87,
|
||||
"execution_count": 85,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1441,7 +1209,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 88,
|
||||
"execution_count": 86,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1453,7 +1221,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 89,
|
||||
"execution_count": 87,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1465,7 +1233,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 90,
|
||||
"execution_count": 88,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1477,7 +1245,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 91,
|
||||
"execution_count": 89,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1491,7 +1259,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 92,
|
||||
"execution_count": 90,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1501,7 +1269,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 93,
|
||||
"execution_count": 91,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1517,7 +1285,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 94,
|
||||
"execution_count": 92,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1546,7 +1314,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 95,
|
||||
"execution_count": 93,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1555,7 +1323,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 96,
|
||||
"execution_count": 94,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1571,7 +1339,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 97,
|
||||
"execution_count": 95,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1582,7 +1350,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 98,
|
||||
"execution_count": 96,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1591,7 +1359,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 99,
|
||||
"execution_count": 97,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1611,7 +1379,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 100,
|
||||
"execution_count": 98,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1622,7 +1390,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 101,
|
||||
"execution_count": 99,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1632,7 +1400,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 102,
|
||||
"execution_count": 100,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1645,7 +1413,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 103,
|
||||
"execution_count": 101,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1663,7 +1431,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 104,
|
||||
"execution_count": 102,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1686,7 +1454,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 105,
|
||||
"execution_count": 103,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1708,7 +1476,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 106,
|
||||
"execution_count": 104,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1717,7 +1485,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 107,
|
||||
"execution_count": 105,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1736,7 +1504,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 108,
|
||||
"execution_count": 106,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1774,7 +1542,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 109,
|
||||
"execution_count": 107,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1800,7 +1568,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 110,
|
||||
"execution_count": 108,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1818,7 +1586,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 111,
|
||||
"execution_count": 109,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1848,7 +1616,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 112,
|
||||
"execution_count": 110,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1881,7 +1649,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 113,
|
||||
"execution_count": 111,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1899,7 +1667,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 114,
|
||||
"execution_count": 112,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1922,7 +1690,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 115,
|
||||
"execution_count": 113,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1947,7 +1715,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 116,
|
||||
"execution_count": 114,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -1986,7 +1754,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 117,
|
||||
"execution_count": 115,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2022,7 +1790,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 118,
|
||||
"execution_count": 116,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2038,7 +1806,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 119,
|
||||
"execution_count": 117,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2048,7 +1816,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 120,
|
||||
"execution_count": 118,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2064,7 +1832,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 121,
|
||||
"execution_count": 119,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2080,7 +1848,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 122,
|
||||
"execution_count": 120,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2092,7 +1860,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 123,
|
||||
"execution_count": 121,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2108,7 +1876,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 124,
|
||||
"execution_count": 122,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2124,7 +1892,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 125,
|
||||
"execution_count": 123,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2154,7 +1922,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 126,
|
||||
"execution_count": 124,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2167,7 +1935,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 127,
|
||||
"execution_count": 125,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2183,7 +1951,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 128,
|
||||
"execution_count": 126,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2217,7 +1985,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 129,
|
||||
"execution_count": 127,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2233,7 +2001,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 130,
|
||||
"execution_count": 128,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -2271,7 +2039,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.6.4"
|
||||
"version": "3.6.5"
|
||||
},
|
||||
"nav_menu": {
|
||||
"height": "279px",
|
||||
|
||||
Reference in New Issue
Block a user