You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1085 lines
640 KiB
1085 lines
640 KiB
2 years ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"___\n",
|
||
|
"\n",
|
||
|
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
|
||
|
"___\n",
|
||
|
"<center><em>Copyright by Pierian Data Inc.</em></center>\n",
|
||
|
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# DBSCAN Hyperparameters\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"Let's explore the hyperparameters for DBSCAN and how they can change results!"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## DBSCAN and Clustering Examples"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import seaborn as sns"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"two_blobs = pd.read_csv('../DATA/cluster_two_blobs.csv')\n",
|
||
|
"two_blobs_outliers = pd.read_csv('../DATA/cluster_two_blobs_outliers.csv')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<AxesSubplot:xlabel='X1', ylabel='X2'>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAA8dUlEQVR4nO3deWCU1bn48e+ZyUwmCUkIgZCYkEBMIBA2IVr0Aq2JInppUVzbe7ELys9WDNW6r9e1Wlu8IrSWurTa9gotVqtFqgK3wFXUgOxbYiSQGCCE7Mkkk8z5/TF5X2aSmZAgYRLm+fyV2d45iXKe9zznnOcorTVCCCFCjyXYDRBCCBEcEgCEECJESQAQQogQJQFACCFClAQAIYQIUWHBbkBPDB48WA8fPjzYzRBCiH5l8+bNx7TWQzo+368CwPDhwykoKAh2M4QQol9RSpX4e15SQEIIEaIkAAghRIiSACCEECFKAoAQQoQoCQBCCBGi+tUqICGEOFPcbs2BygaO1DoZGuNgeHwUFosKdrNOKwkAQgjRgdutWb3rMHes2IrT5cZhs7DouonMzE48q4KApICEECHH7dYUV9Tz8RfH2Haoms8OVFJcUY/b7SmPf6Cywez8AZwuN3es2MqByoZgNvu0kxGAECKk+Lu7z8/NZHnBQe6ZOZqZ2YkcqXWanb/B6XJztM5J+pABQWr56ScjACFESPF3d794bSGzxiebd/lDYxw4bL7do8NmISHaEYwm9xoJAEKIkBLo7l4piIu0U1HXzJFaJ7+bm0NafASAOQcwPD4qGE3uNZICEkKEFOPu3jsIOGwWouxWbrwwje+/+qmZGnrm6vEkD3QwKCr8rFwFJCMAIcRZz3vSV2tY8r3zzBSPMQcA8PyaQp/U0KIP9mGzWjhS6+RAZYM5SdzV9b0nk/s6GQEIIfq1k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StmAd4F/aq0Xnez9EgCEEK2tbt7aVuazqubx2WMZnxLNP3YcMXPyi9d6JnONTjUp1sGcSSlYLTA5dSDlNc38l9dqH+87coAXvnseT63aw5xJKX475l9eM4GGllbio+yUVTXxykdf8qOLRlDZ2IJbg1XBoEg7r3z0JXdcOpKyKifLCw4ya3wyVguMOycWqwWON7o4UuvEZlE89d6+Tr/v/9z8DS48d/DX+psFCgBBmwNQSingZWBPdzp/IYQA2FVeY3b+cGJ37vGGVkYNjWbW+GSziFtqXAQ3TUtnfHIMc6ek8fLGYhavKWLzwWqz8zeusXhtIXMmpZAU6yA/LwOnq42rJ6cQHmbxm9rZf7SOe1buYMH/fI7dZuW+mVlEOcJ4e2sZWnuWNg6NdRDrsHHOwAiUggUXZxJmgb8UlHLbG5+z70g9v3p/Py+sLSIuKtzM+RscNguuNt1rO4WDOQfwb8BcYIdSamv7c/drrVcFr0lCiL6uvMb/yp9DxxsZlRhDWVWjOQIw7u4fmjWGZeu/MD/n1v7z9eFhFm68MM0n3bP4hvP8rshpc5/43KPv7OIX10zghbWFnb77yavGcuBYo881jdHG82s8o5Sl64p46O2d/OY/J/PjP272ed9Db+/g1R9c0CuVRYMWALTWG4G+XSxbCNHnJMVG+O2Qh8Y6OFzrJDs5lnl/KPC5u3/83d1mR+v9mY7XmDAslv/3+mafzz65anenzWH5uZms3lnOrRdnmDl9rd1+VwKVVDaybH1xp9GG0R7j806XG6erzdyroDVmSqqki/MOvo4+sQpICCG6Kzsphsdnj/Wp2PnYd7J5Yc1+CkpquP/yrIAVOg0rN5eyMC+z0135nvLaTp9tadXmpLBbQ9bQaH7/UTEzxyb53Ok/ceVYYh3WTp8PNNow6gkZ07AOm4WkGAe3L9/aKTB9fqiaxWuKTntJCAkAQoh+JSzMwuzx55ASF0FpVRMpcRH86v29FJTUAOByu/3e3Y9
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sns.scatterplot(data=two_blobs,x='X1',y='X2')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 22,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<AxesSubplot:xlabel='X1', ylabel='X2'>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 22,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAA9iUlEQVR4nO3deXzU1bn48c+ZySSTnRASEhOSEBMIhE2IFv0BrYki+qNFcW3vxS4oP1sxVOpel+t6tbZ4Rei1uN3qba/SYrVapCrQAldRA7JvCZFAYiAhZE8mmWTO74/J98tMMgkJEiZhnvfr1deL2b5zkprzfM9zznmO0lojhBAi8Fj83QAhhBD+IQFACCEClAQAIYQIUBIAhBAiQEkAEEKIABXk7wb0xbBhw3RaWpq/myGEEIPKli1bjmut4zo/P6gCQFpaGgUFBf5uhhBCDCpKqRJfz0sKSAghApQEACGECFASAIQQIkBJABBCiAAlAUAIIQLUoFoFJIQQZ4vLpTlU1cixOgfDo+ykxYZjsSh/N+uMkgAghBCduFyaNbuPsnjlNhxOF3abhSU3TGJWdsI5FQQkBSSECDgul6a4soFPDx5n+5EavjhURXFlAy6Xuzz+oapGs/MHcDhdLF65jUNVjf5s9hknIwAhREDxdXefn5vJWwWHuXfWGGZlJ3CszmF2/gaH00VFvYP0uAg/tfzMkxGAECKg+Lq7X7qukNkTks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i+PFLD0rVFZ7wkhAQAIcSgEhRkYc6E80iOCaW0upnkmFB+8+E+CkpqAXC6XD7
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# plt.figure(figsize=(10,6),dpi=200)\n",
|
||
|
"sns.scatterplot(data=two_blobs_outliers,x='X1',y='X2')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Label Discovery"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def display_categories(model,data):\n",
|
||
|
" labels = model.fit_predict(data)\n",
|
||
|
" sns.scatterplot(data=data,x='X1',y='X2',hue=labels,palette='Set1')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## DBSCAN"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from sklearn.cluster import DBSCAN"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Help on class DBSCAN in module sklearn.cluster._dbscan:\n",
|
||
|
"\n",
|
||
|
"class DBSCAN(sklearn.base.ClusterMixin, sklearn.base.BaseEstimator)\n",
|
||
|
" | DBSCAN(eps=0.5, *, min_samples=5, metric='euclidean', metric_params=None, algorithm='auto', leaf_size=30, p=None, n_jobs=None)\n",
|
||
|
" | \n",
|
||
|
" | Perform DBSCAN clustering from vector array or distance matrix.\n",
|
||
|
" | \n",
|
||
|
" | DBSCAN - Density-Based Spatial Clustering of Applications with Noise.\n",
|
||
|
" | Finds core samples of high density and expands clusters from them.\n",
|
||
|
" | Good for data which contains clusters of similar density.\n",
|
||
|
" | \n",
|
||
|
" | Read more in the :ref:`User Guide <dbscan>`.\n",
|
||
|
" | \n",
|
||
|
" | Parameters\n",
|
||
|
" | ----------\n",
|
||
|
" | eps : float, default=0.5\n",
|
||
|
" | The maximum distance between two samples for one to be considered\n",
|
||
|
" | as in the neighborhood of the other. This is not a maximum bound\n",
|
||
|
" | on the distances of points within a cluster. This is the most\n",
|
||
|
" | important DBSCAN parameter to choose appropriately for your data set\n",
|
||
|
" | and distance function.\n",
|
||
|
" | \n",
|
||
|
" | min_samples : int, default=5\n",
|
||
|
" | The number of samples (or total weight) in a neighborhood for a point\n",
|
||
|
" | to be considered as a core point. This includes the point itself.\n",
|
||
|
" | \n",
|
||
|
" | metric : string, or callable, default='euclidean'\n",
|
||
|
" | The metric to use when calculating distance between instances in a\n",
|
||
|
" | feature array. If metric is a string or callable, it must be one of\n",
|
||
|
" | the options allowed by :func:`sklearn.metrics.pairwise_distances` for\n",
|
||
|
" | its metric parameter.\n",
|
||
|
" | If metric is \"precomputed\", X is assumed to be a distance matrix and\n",
|
||
|
" | must be square. X may be a :term:`Glossary <sparse graph>`, in which\n",
|
||
|
" | case only \"nonzero\" elements may be considered neighbors for DBSCAN.\n",
|
||
|
" | \n",
|
||
|
" | .. versionadded:: 0.17\n",
|
||
|
" | metric *precomputed* to accept precomputed sparse matrix.\n",
|
||
|
" | \n",
|
||
|
" | metric_params : dict, default=None\n",
|
||
|
" | Additional keyword arguments for the metric function.\n",
|
||
|
" | \n",
|
||
|
" | .. versionadded:: 0.19\n",
|
||
|
" | \n",
|
||
|
" | algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, default='auto'\n",
|
||
|
" | The algorithm to be used by the NearestNeighbors module\n",
|
||
|
" | to compute pointwise distances and find nearest neighbors.\n",
|
||
|
" | See NearestNeighbors module documentation for details.\n",
|
||
|
" | \n",
|
||
|
" | leaf_size : int, default=30\n",
|
||
|
" | Leaf size passed to BallTree or cKDTree. This can affect the speed\n",
|
||
|
" | of the construction and query, as well as the memory required\n",
|
||
|
" | to store the tree. The optimal value depends\n",
|
||
|
" | on the nature of the problem.\n",
|
||
|
" | \n",
|
||
|
" | p : float, default=None\n",
|
||
|
" | The power of the Minkowski metric to be used to calculate distance\n",
|
||
|
" | between points.\n",
|
||
|
" | \n",
|
||
|
" | n_jobs : int, default=None\n",
|
||
|
" | The number of parallel jobs to run.\n",
|
||
|
" | ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.\n",
|
||
|
" | ``-1`` means using all processors. See :term:`Glossary <n_jobs>`\n",
|
||
|
" | for more details.\n",
|
||
|
" | \n",
|
||
|
" | Attributes\n",
|
||
|
" | ----------\n",
|
||
|
" | core_sample_indices_ : ndarray of shape (n_core_samples,)\n",
|
||
|
" | Indices of core samples.\n",
|
||
|
" | \n",
|
||
|
" | components_ : ndarray of shape (n_core_samples, n_features)\n",
|
||
|
" | Copy of each core sample found by training.\n",
|
||
|
" | \n",
|
||
|
" | labels_ : ndarray of shape (n_samples)\n",
|
||
|
" | Cluster labels for each point in the dataset given to fit().\n",
|
||
|
" | Noisy samples are given the label -1.\n",
|
||
|
" | \n",
|
||
|
" | Examples\n",
|
||
|
" | --------\n",
|
||
|
" | >>> from sklearn.cluster import DBSCAN\n",
|
||
|
" | >>> import numpy as np\n",
|
||
|
" | >>> X = np.array([[1, 2], [2, 2], [2, 3],\n",
|
||
|
" | ... [8, 7], [8, 8], [25, 80]])\n",
|
||
|
" | >>> clustering = DBSCAN(eps=3, min_samples=2).fit(X)\n",
|
||
|
" | >>> clustering.labels_\n",
|
||
|
" | array([ 0, 0, 0, 1, 1, -1])\n",
|
||
|
" | >>> clustering\n",
|
||
|
" | DBSCAN(eps=3, min_samples=2)\n",
|
||
|
" | \n",
|
||
|
" | See also\n",
|
||
|
" | --------\n",
|
||
|
" | OPTICS\n",
|
||
|
" | A similar clustering at multiple values of eps. Our implementation\n",
|
||
|
" | is optimized for memory usage.\n",
|
||
|
" | \n",
|
||
|
" | Notes\n",
|
||
|
" | -----\n",
|
||
|
" | For an example, see :ref:`examples/cluster/plot_dbscan.py\n",
|
||
|
" | <sphx_glr_auto_examples_cluster_plot_dbscan.py>`.\n",
|
||
|
" | \n",
|
||
|
" | This implementation bulk-computes all neighborhood queries, which increases\n",
|
||
|
" | the memory complexity to O(n.d) where d is the average number of neighbors,\n",
|
||
|
" | while original DBSCAN had memory complexity O(n). It may attract a higher\n",
|
||
|
" | memory complexity when querying these nearest neighborhoods, depending\n",
|
||
|
" | on the ``algorithm``.\n",
|
||
|
" | \n",
|
||
|
" | One way to avoid the query complexity is to pre-compute sparse\n",
|
||
|
" | neighborhoods in chunks using\n",
|
||
|
" | :func:`NearestNeighbors.radius_neighbors_graph\n",
|
||
|
" | <sklearn.neighbors.NearestNeighbors.radius_neighbors_graph>` with\n",
|
||
|
" | ``mode='distance'``, then using ``metric='precomputed'`` here.\n",
|
||
|
" | \n",
|
||
|
" | Another way to reduce memory and computation time is to remove\n",
|
||
|
" | (near-)duplicate points and use ``sample_weight`` instead.\n",
|
||
|
" | \n",
|
||
|
" | :class:`cluster.OPTICS` provides a similar clustering with lower memory\n",
|
||
|
" | usage.\n",
|
||
|
" | \n",
|
||
|
" | References\n",
|
||
|
" | ----------\n",
|
||
|
" | Ester, M., H. P. Kriegel, J. Sander, and X. Xu, \"A Density-Based\n",
|
||
|
" | Algorithm for Discovering Clusters in Large Spatial Databases with Noise\".\n",
|
||
|
" | In: Proceedings of the 2nd International Conference on Knowledge Discovery\n",
|
||
|
" | and Data Mining, Portland, OR, AAAI Press, pp. 226-231. 1996\n",
|
||
|
" | \n",
|
||
|
" | Schubert, E., Sander, J., Ester, M., Kriegel, H. P., & Xu, X. (2017).\n",
|
||
|
" | DBSCAN revisited, revisited: why and how you should (still) use DBSCAN.\n",
|
||
|
" | ACM Transactions on Database Systems (TODS), 42(3), 19.\n",
|
||
|
" | \n",
|
||
|
" | Method resolution order:\n",
|
||
|
" | DBSCAN\n",
|
||
|
" | sklearn.base.ClusterMixin\n",
|
||
|
" | sklearn.base.BaseEstimator\n",
|
||
|
" | builtins.object\n",
|
||
|
" | \n",
|
||
|
" | Methods defined here:\n",
|
||
|
" | \n",
|
||
|
" | __init__(self, eps=0.5, *, min_samples=5, metric='euclidean', metric_params=None, algorithm='auto', leaf_size=30, p=None, n_jobs=None)\n",
|
||
|
" | Initialize self. See help(type(self)) for accurate signature.\n",
|
||
|
" | \n",
|
||
|
" | fit(self, X, y=None, sample_weight=None)\n",
|
||
|
" | Perform DBSCAN clustering from features, or distance matrix.\n",
|
||
|
" | \n",
|
||
|
" | Parameters\n",
|
||
|
" | ----------\n",
|
||
|
" | X : {array-like, sparse matrix} of shape (n_samples, n_features), or (n_samples, n_samples)\n",
|
||
|
" | Training instances to cluster, or distances between instances if\n",
|
||
|
" | ``metric='precomputed'``. If a sparse matrix is provided, it will\n",
|
||
|
" | be converted into a sparse ``csr_matrix``.\n",
|
||
|
" | \n",
|
||
|
" | sample_weight : array-like of shape (n_samples,), default=None\n",
|
||
|
" | Weight of each sample, such that a sample with a weight of at least\n",
|
||
|
" | ``min_samples`` is by itself a core sample; a sample with a\n",
|
||
|
" | negative weight may inhibit its eps-neighbor from being core.\n",
|
||
|
" | Note that weights are absolute, and default to 1.\n",
|
||
|
" | \n",
|
||
|
" | y : Ignored\n",
|
||
|
" | Not used, present here for API consistency by convention.\n",
|
||
|
" | \n",
|
||
|
" | Returns\n",
|
||
|
" | -------\n",
|
||
|
" | self\n",
|
||
|
" | \n",
|
||
|
" | fit_predict(self, X, y=None, sample_weight=None)\n",
|
||
|
" | Perform DBSCAN clustering from features or distance matrix,\n",
|
||
|
" | and return cluster labels.\n",
|
||
|
" | \n",
|
||
|
" | Parameters\n",
|
||
|
" | ----------\n",
|
||
|
" | X : {array-like, sparse matrix} of shape (n_samples, n_features), or (n_samples, n_samples)\n",
|
||
|
" | Training instances to cluster, or distances between instances if\n",
|
||
|
" | ``metric='precomputed'``. If a sparse matrix is provided, it will\n",
|
||
|
" | be converted into a sparse ``csr_matrix``.\n",
|
||
|
" | \n",
|
||
|
" | sample_weight : array-like of shape (n_samples,), default=None\n",
|
||
|
" | Weight of each sample, such that a sample with a weight of at least\n",
|
||
|
" | ``min_samples`` is by itself a core sample; a sample with a\n",
|
||
|
" | negative weight may inhibit its eps-neighbor from being core.\n",
|
||
|
" | Note that weights are absolute, and default to 1.\n",
|
||
|
" | \n",
|
||
|
" | y : Ignored\n",
|
||
|
" | Not used, present here for API consistency by convention.\n",
|
||
|
" | \n",
|
||
|
" | Returns\n",
|
||
|
" | -------\n",
|
||
|
" | labels : ndarray of shape (n_samples,)\n",
|
||
|
" | Cluster labels. Noisy samples are given the label -1.\n",
|
||
|
" | \n",
|
||
|
" | ----------------------------------------------------------------------\n",
|
||
|
" | Data descriptors inherited from sklearn.base.ClusterMixin:\n",
|
||
|
" | \n",
|
||
|
" | __dict__\n",
|
||
|
" | dictionary for instance variables (if defined)\n",
|
||
|
" | \n",
|
||
|
" | __weakref__\n",
|
||
|
" | list of weak references to the object (if defined)\n",
|
||
|
" | \n",
|
||
|
" | ----------------------------------------------------------------------\n",
|
||
|
" | Methods inherited from sklearn.base.BaseEstimator:\n",
|
||
|
" | \n",
|
||
|
" | __getstate__(self)\n",
|
||
|
" | \n",
|
||
|
" | __repr__(self, N_CHAR_MAX=700)\n",
|
||
|
" | Return repr(self).\n",
|
||
|
" | \n",
|
||
|
" | __setstate__(self, state)\n",
|
||
|
" | \n",
|
||
|
" | get_params(self, deep=True)\n",
|
||
|
" | Get parameters for this estimator.\n",
|
||
|
" | \n",
|
||
|
" | Parameters\n",
|
||
|
" | ----------\n",
|
||
|
" | deep : bool, default=True\n",
|
||
|
" | If True, will return the parameters for this estimator and\n",
|
||
|
" | contained subobjects that are estimators.\n",
|
||
|
" | \n",
|
||
|
" | Returns\n",
|
||
|
" | -------\n",
|
||
|
" | params : mapping of string to any\n",
|
||
|
" | Parameter names mapped to their values.\n",
|
||
|
" | \n",
|
||
|
" | set_params(self, **params)\n",
|
||
|
" | Set the parameters of this estimator.\n",
|
||
|
" | \n",
|
||
|
" | The method works on simple estimators as well as on nested objects\n",
|
||
|
" | (such as pipelines). The latter have parameters of the form\n",
|
||
|
" | ``<component>__<parameter>`` so that it's possible to update each\n",
|
||
|
" | component of a nested object.\n",
|
||
|
" | \n",
|
||
|
" | Parameters\n",
|
||
|
" | ----------\n",
|
||
|
" | **params : dict\n",
|
||
|
" | Estimator parameters.\n",
|
||
|
" | \n",
|
||
|
" | Returns\n",
|
||
|
" | -------\n",
|
||
|
" | self : object\n",
|
||
|
" | Estimator instance.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"help(DBSCAN)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 9,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"dbscan = DBSCAN()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABUE0lEQVR4nO3dd3iT19n48e/RHpbkvfcE22yzSQgjAbII2Xs2adN0r7RN2/fXnb7N23SkK4MmTdKsZu8JhL23jRfGe29bW3p+f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YopSbfzzoyoKkqxMzoikIMlGfqKVteVtbK/pAmD51FR++Uop3YOBBjktxsQd5+Xw85f2khJlYk99L9fOzmDl6mqumJHOK9uOzAJ8fnMdFoOW0sZettV0IQR8c0kBf363nKG1Zry1q5EvL8rj7x9U8oOLx3PR5BT6nV6y4iKIMKgZcB5p8Ofmx57WX/8QwllAiqI0K4qyY+jP/UAZkBKqeE7VO++8Q0FBAbm5udx///2hDkeSxqTkKBMPXD+FrLjA7Jy8RAu/u3Yy8daRDV+81cCXF+YOO5ZoM5ARa+Lwnks6tQqzXsNlJanE2/TcvSiPjFgzkSYdLwwN+N42P5v/bKhl5ZpqnlxfQ3FaJOeOC3TLuLw+jl7MW99pp7ypD4tBy4DTQ36ihW0Hu0iPNbO/oWdEjLvquslNsJCbYOE7y8bj8vi547xclk9LBQJjGIfaB4mz6Flf0c5L2+q57Z8b+fHzu/nGknHBGU1z82P5+gUFGHXqEe9xKs6KMQAhRCYwBdh8jOfuAu4CSE8fOeXrbODz+bjnnnt4//33SU1
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"display_categories(dbscan,two_blobs)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABV20lEQVR4nO3dd3iT19n48e/RlmxJ3ntPsM02m4SZABkQsvdO2jTdK23ztu+v803btGmbNG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XDz/2XQIFLh2Zpr/7uIXKwrIT7Lyr08ryI23MDE1jNx4KzlxFtaVtrCjqgOA5ZOT+PUbxXT2+xrk5EgTd8zL5Jev7SMx3MTe2m6unZnKyjWVXDEthTe2H5kF+PKWGswGLcX13Wyv6kAI+M7iXP72YSmDa814b3c9X1uYzT8+KefHl4zl4omJ9NrdpEeHEmpQ02c/0uDPzok6rb/+IYCzgBRFaVQUZefg//cCJUBioOI5VR988AG5ublkZWXxwAMPBDocSRqVEsJNPHj9JNKjfbNzsuPM/P7aicRYhjd8MRYDX1uQNeRYnNVAapSJw3su6dQqQvQaLitMIsaq556F2aRGhRBm0vHK4IDvbXMz+M/GalaureTZDVUUJIdx/hhft4zD7eHoxby17QOUNvRgNmjps7vIiTOz/WAHKVEhFNV1DYtxd00nWbFmsmLNfH/pWBwuL3fMy2L5lCTAN4ZxqLWfaLOeDWWtvLa9ltv+tYmfvbyHby8e45/RNDsnim9dmItRpx72HqfirBgDEEKkAZOALcd47m7gboCUlOFTvs4GHo+He++9l48//pi
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Epsilon\n",
|
||
|
"\n",
|
||
|
" eps : float, default=0.5\n",
|
||
|
" | The maximum distance between two samples for one to be considered\n",
|
||
|
" | as in the neighborhood of the other. This is not a maximum bound\n",
|
||
|
" | on the distances of points within a cluster. This is the most\n",
|
||
|
" | important DBSCAN parameter to choose appropriately for your data set\n",
|
||
|
" | and distance function."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 81,
|
||
|
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M6tX3yr2GFCYApVQ94FWgBolGvue01mP29Dp169ZlzZo1VWp9/a07ggkhyosXF8P2T8jRKPGS4grHxtavx/fCi+XKdCCQHLcPYNSqiaN3b/xjx4LdgWfwVaAUllat8D3zDJ6bhkEohNm0KaVvv0Po68kotxtrm0OJrVlD3OvD0asX9i5dIBYjMm8eOholtmoV/ldeJeu+e/CNHYfrwgswcnMJ//EHJTcPB8B14QVk9O+Pd+zTOI7ug1m7NtZDDyVeWEjo229x9OqFrUMHjCaNicxfgKVpE5TNlrgP2/QZJO/Nhg3E/X7MCu/8e6l8AogCN2itZyilPMDvSqmvtNY7aDDbOavVKjtrCXGAsNSrh5GTXa4CNGrUwFKvfoVjlcWCkeEkHgqVf2ObdvKMfv3wPfc/0Br35ZfhHZ34jZk9ZhS2du3wPvIo1tat8XTpgu2QQ7AdfDCBL79MrheUcfbZFF03lPiWLUBiroDn+qEUXTMEs0EDwtN+xz3wckpGjcZ14QWUvv5G8rP9L7yIkZlJZOZMwj/9BEqRddcdFN99b7JZqfT9D8i8aRgFDz5E9kMPknFGf+IlJYnF6Lbr97D36Y1Zo8Z/u8HbSdkoIK31eq31jLK/e4EFQJ1dnyWEOJBZ6tcn96WXsDRrlnh98MHkvvA/zFo1Kxxr1qyJZ9iw8mV16mBp2gTKmoOV3Y7yuHGddy5GnTp4ht+MpUkTzNw8/C++BIBnyLX4nnkW7+gxeJ8eh61DBxzHHguADgbLzQ6OLVtOdPYcVFYWuqQEyyEHE/zxRyxNGlds5wdCU6dibdkSS6uWZN17D/FAEM/1Q8k45+zEAeEw0cVLMGvWJDh5Mr7XXmdT3xMoHDSIrDtux17W5m/v05us227DyMj4j3e
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Tiny Epsilon --> Tiny Max Distance --> Everything is an outlier (class=-1)\n",
|
||
|
"dbscan = DBSCAN(eps=0.001)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 82,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABTDElEQVR4nO3dd5gTVffA8e+dSd0kW1l6b1JEelFERLCABQtiFytiRVQUrD87NhAVUV97r2BBRQUVC0oR6YggvUnZlmTTc39/ZAksCwjCEjDn8zw8L7mZmZyML3Myd+49V2mtEUIIkX6MVAcghBAiNSQBCCFEmpIEIIQQaUoSgBBCpClJAEIIkaYsqQ5gb1SpUkXXr18/1WEIIcQh5bffftustc7fsf2QSgD169dn5syZqQ5DCCEOKUqplTtrly4gIYRIU5IAhBAiTUkCEEKINHVIPQPYmUgkwpo1awgGg6kOZZccDge1a9fGarWmOhQhhEg65BPAmjVr8Hg81K9fH6VUqsOpQGvNli1bWLNmDQ0aNEh1OEIIkXTIJ4BgMHjQXvwBlFLk5eWxadOmVIcihNgLsc2bicydS2zjJiz16mJt1QrD7U51WPvVIZ8AgIP24r/VwR6fEOkstnkzurQUs1o1lN2eaCsupvi++wl8NC65XdZ99+K69BKU8d95dPrf+SZCCLGHYhs2EJz6C4HJkym6+x7+7tqNwpuHElm2HIDo4j/LXfwBih96mOiKFSmItvJIAthPJk6cyGGHHUbjxo0ZMWJEqsMRQuxCZNEiNp1+JlvO7k/BxZdAOIzz1FMJjB9PyciR6FCIuLek4o7BINpfesDjrUySAPaDWCzGtddey5dffsnChQt55513WLhwYarDEkLsQIdClDz1NLHVq5NtwS8nY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XvvgexGM5TT0EpRdGQm5LHy3nxBeKFhXhuvonQlB+wNDsM56mnEPjqa7BaMXJzcV9+Gb7nnsd5xuk4ju2OefGFgML34ktgGMQDAWzNDsPwZGKpWwfT4yFz6C0U3TI0MdzcYsF1yQAiCxZg1KhOfP0GHL16VjgPkYULt138AeJxim6/A1vbNphVq+6Xcw0pTABKqTrA60A1Ep18L2itR+/tcWrXrs2aNWsO6nr7W1cEE0LsXry4GHa8Y45GiZcUV9g2tn49vpdeLtemAwF08bZtjRrVcfTsiX/MGLA78Fx7DSiFpUULfM89h+fWoYnx+40bU/rue4QmTUa53VhbH0FszRriXh+OHj2wd+4MsRiRBQvQ0SixVavwv/Y6WQ/ch2/MWFwDLsbIzSX8+++U3DYMANeAi8no1w/vmGdxHN8Ls2ZNrEccQbywkNB33+Ho0QNb+/YYjRoSWbgIS+NGKJstcR62e2aQPDcbNhD3+zH38RxvL5V3AFHgZq31LKWUB/hNKfWN1nqvqqhZrVZZaUuI/whLnToYOdnlLoBGtWpY6tStsK2yWDAynMRDofJvbNdPntG3L74X/gda477yCrxPJn5jZo8eha1tW7yPPoa1VSs8nTtjO/xwbC1bEvj662S9oIzzzqPoxiHEt2wBEnMFPDcNoej6wZj16hGe8RvugVdSMupJXAMupvTNt5Kf7X/pZYzMTCKzZxP++WdQiqz/u5vie+9PdiuVfvgRmbcOpeDhEWSPeJiMs/sRLylJFKPb4bmHvVdPzGrV9u0E7yBlo4C01uu11rPK/u4FFgEyfVaINGapW5fcV17B0qRJ4nXLluS+9D/MGtUrbGtWr45n6NDybbVqYWncKDFuH1B2O8rjxnXhBRi1auEZdhuWRo0wc/Pwv/wKAJ7BN+B77nm8T47G++xYbO3b4zjxRAB0MAjmtt/csWXLic6dh8rKQpeUYDm8JcGffsLSqGHFfn4gNH061ub
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Huge Epsilon --> Huge Max Distance --> Everything is in the same cluster (class=0)\n",
|
||
|
"dbscan = DBSCAN(eps=10)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABpkAAAQICAYAAAD2nLMMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAB7CAAAewgFu0HU+AAEAAElEQVR4nOzdd3Qc5dn+8e9sUa+WZHXZsuXei+SGwaZ3MAYDprcQAgkBQhJC6ptCSEJLfkBCCQZCx2AMpoMBd8u9F9lWl1Ws3nd35veHLGFZdeUmw/U55z2v2J1n9tnZtZ0zl+77NizLQkRERERERERERERERMQbthO9ARERERERERERERERETn5KGQSERERERERERERERERrylkEhEREREREREREREREa8pZBIRERERERERERERERGvKWQSERERERERERERERERrylkEhEREREREREREREREa8pZBIRERERERERERERERGvKWQSERERERERERERERERrylkEhEREREREREREREREa8pZBIRERERERERERERERGvKWQSERERERERERERERERrylkEhEREREREREREREREa8pZBIRERERERERERERERGvKWQSERERERERERERERERrylkEhEREREREREREREREa8pZBIRERERERERERERERGvOU70BuToMwzDFxh18D+LAc8J3I6IiIiIiIiIiIiIiJxYdiDq4M+bLctqOBonVcj03TQKSD/RmxARERERERERERERkV4nFVhzNE6kdnkiIiIiIiIiIiIiIiLiNVUyfTcVN/+wevVqYmNjT+ReRERERERERERERETkBCooKCAtLa35P4s7O9YbCpm+m1pmMMXGxpKQkHAi9yIiIiIiIiIiIiIiIr2Hp+tDukft8kRERERERERERERERMRrCplERERERERERERERETEawqZRERERERERERERERExGsKmURERERERERERERERMRrCplERERERERERERERETEawqZRERERERERERERERExGsKmURERERERERERERERMRrCplERERERERERERERETEawqZRERERERERERERERExGsKmURERERERERERERERMRrjhO9Aem9TNOkurqayspKGhsb8Xg8J3pLcpTZ7XZ8fHwICQkhKCgIm025s4iIiIiIiIiIiIh0j0ImaVdVVRV5eXlY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
|
||
|
"text/plain": [
|
||
|
"<Figure size 2000x1200 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# How to find a good epsilon?\n",
|
||
|
"plt.figure(figsize=(10,6),dpi=200)\n",
|
||
|
"dbscan = DBSCAN(eps=1)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 51,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"array([ 0, 1, 0, ..., -1, -1, -1], dtype=int64)"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 51,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"dbscan.labels_"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 52,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"array([False, False, False, ..., True, True, True])"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 52,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"dbscan.labels_ == -1"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 54,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"3"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 54,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"np.sum(dbscan.labels_ == -1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 57,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"0.29910269192422734"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 57,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"100 * np.sum(dbscan.labels_ == -1) / len(dbscan.labels_)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Charting reasonable Epsilon values"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 159,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# bend the knee! https://raghavan.usc.edu/papers/kneedle-simplex11.pdf"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 170,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# np.arange(start=0.01,stop=10,step=0.01)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 189,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"outlier_percent = []\n",
|
||
|
"number_of_outliers = []\n",
|
||
|
"\n",
|
||
|
"for eps in np.linspace(0.001,10,100):\n",
|
||
|
" \n",
|
||
|
" # Create Model\n",
|
||
|
" dbscan = DBSCAN(eps=eps)\n",
|
||
|
" dbscan.fit(two_blobs_outliers)\n",
|
||
|
" \n",
|
||
|
" # Log Number of Outliers\n",
|
||
|
" number_of_outliers.append(np.sum(dbscan.labels_ == -1))\n",
|
||
|
" \n",
|
||
|
" # Log percentage of points that are outliers\n",
|
||
|
" perc_outliers = 100 * np.sum(dbscan.labels_ == -1) / len(dbscan.labels_)\n",
|
||
|
" \n",
|
||
|
" outlier_percent.append(perc_outliers)\n",
|
||
|
" "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 190,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"Text(0.5, 0, 'Epsilon Value')"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 190,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAg80lEQVR4nO3de5hcVZnv8e+vLk065EYgw0BIJEJGxQuCDYJ4HAUcQa56FEFRRJTjGQa8MCg4Ksdz9BxFR0VGGaMoURFBREFEAQPCqCPSAQS5SU4QSQgQlFzk1rd3/ti7qqs73ZWd7t670l2/z/P0U1WrLuutoP32etdeaykiMDMzAyi1OgAzM9t6OCmYmVmdk4KZmdU5KZiZWZ2TgpmZ1VVaHcB47LDDDrHrrru2Ogwzs0ll+fLlj0fEvJGem9RJYdddd6W7u7vVYZiZTSqSHhztOZePzMyszknBzMzqnBTMzKzOScHMzOo2mxQkvVnSzPT+RyVdLmnv/EMzM7OiZRkpfCwiNkp6JXAwcAFw/ubeJOkbkh6T9PuGtrmSrpN0f3q7XdouSV+StELSHU46ZmatkSUp9Ke3hwFLIuInQEeG910IHDKs7UxgWUQsBpaljwEOBRanPyeTIemYmdnEy5IUVkv6KvAW4GpJ22R5X0TcBPxlWPNRwNL0/lLg6Ib2b0XiN8AcSTtliG1MbvnjX/jXa++jt38gry7MzCalLEnhGOAa4HURsQ6YC5wxxv52jIg16f1HgB3T+/OBhxpetypt24SkkyV1S+peu3btmIK47U9PcN71K+jpc1IwM2vUdEWzpDJwa0Q8v9aW/lJfM/q7somIkLTFJ/xExBJgCUBXV9eYTgiqlJJc6JGCmdlQTUcKEdEP3Cdp4QT192itLJTePpa2rwYWNLxul7QtF9VK8rV7nBTMzIbIUj7aDrhL0jJJV9Z+xtjflcAJ6f0TgCsa2t+RXoW0H7C+ocw04TrKAqCv30eRmpk1yrIh3sfG8sGSL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coypEC4fmZltarNJQdLZwIdJTl8DqALfyTOoItRGCn0DTgpmZjVZRgpvAI4EngSIiIcZvFx10qrURgp9Lh+ZmdVkSQo9ERFAAEjaNt+QitHhFc1mZpvIkhQulfRVYI6k9wA/B76Wb1j5q5ePnBTMzOqyXH30OUmvBTaQrG7+eERcl3tkOav4kB0zs01kWadAmgQmfSJoVL8k1RPNZmZ1zTbE+2VEvFLSRtL5hNpTQETErNyjy1E9KXii2cysrtlI4R0AETHprzQaSbkkSvI6BTOzRs0mmr8PIGlZQbEUrlouuXxkZtag2UihJOkjwN+NdLbCZD9PAdKk4PKRmVlds5HCsUA/SeKYOcLPpFctyyuazcwaNDtP4T7gM5LuiIifFhhTYSrlkucUzMwaNLv66PiI+A6wh6QXDH9+KpSPOsolelw+MjOrazanUNvOYkYRgbSCy0dmZkM1Kx99Nb39RHHhFMvlIzOzobJsnX2OpFmSqpKWSVor6fgigstbtVzyNhdmZg2ybIj3DxGxATgc+COwO3DGeDqVNEfSZZLulXSPpP0lzZV0naT709vtxtNHFtWyPFIwM2uQJSnUSkyHAd+PiPUT0O+5wM8i4vnAnsA9wJnAsohYDCxLH+eq6vKRmdkQWZLCVZLuBV4GLJM0D3hmrB1Kmg28CrgAICJ6ImIdcBSwNH3ZUuDosfaRVTJScPnIzKxms0khIs4EXgF0RUQvyQlsR42jz0XAWuCbkm6T9PX04J4dI2JN+ppHgB1HerOkkyV1S+peu3btOMLwSMHMbLgsE81vBnojol/SR0nOZ955HH1WgL2B8yNiL5IkM6RU1HjS23ARsSQiuiKia968eeMII0kKfR4pmJnVZSkffSwiNkp6JXAwSdnn/HH0uQpYFRE3p48vI0kSj0raCSC9fWwcfWRSKXm
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sns.lineplot(x=np.linspace(0.001,10,100),y=outlier_percent)\n",
|
||
|
"plt.ylabel(\"Percentage of Points Classified as Outliers\")\n",
|
||
|
"plt.xlabel(\"Epsilon Value\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 192,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"(0.0, 1.0)"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 192,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAEGCAYAAACgt3iRAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAp00lEQVR4nO3deZxddX3/8dd7lmSyZ24WCNlmIvtOmJmAWJVNWSxYBQVF0WJpKyoqbcVSS6u/X6ulglKpLSoK/oSqVCQClVpAUaskk7CERUzIRtgCyWQjZJmZz++Pcya5GTJ3Tmbm3jt35v18PM7jnvM92yfHkI/f7/ec71cRgZmZWX9UlTsAMzOrfE4mZmbWb04mZmbWb04mZmbWb04mZmbWbzXlDqAYJk+eHA0NDeUOw8ysoixatOiViJjSl3OHZDJpaGigtbW13GGYmVUUSav6eq6buczMrN+cTMzMrN+cTMzMrN+cTMzMrN+cTMzMrN+cTMzMrN+Klkwk3SRpraTH88pykn4maWn6W5+WS9L1kpZJekzS3LxzLk6PXyrp4mLFa2ZmfVfMmsl3gDO6lV0J3BcRBwH3pdsAZwIHpculwNchST7A1cA8oAW4uisBFbJ283Yef27jAPwRzMwsi6Ilk4h4EFjfrfhc4OZ0/WbgnXnlt0Tit8BESdOAtwM/i4j1EdEG/IzXJ6jXeWnTNu57au0A/CnMzCyLUveZ7BcRL6TrLwL7pev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9ku6V9CFJHwLuBv6nuGGVT0tjjpc2befZ9a+VOxQzs4qRZQj6j0n6I+DNadGNEXFHccMqn3mNyfcmD61Yx6xJo8scjZlZZcj6avBi4O6I+BRwr6Qh2zt
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sns.lineplot(x=np.linspace(0.001,10,100),y=number_of_outliers)\n",
|
||
|
"plt.ylabel(\"Number of Points Classified as Outliers\")\n",
|
||
|
"plt.xlabel(\"Epsilon Value\")\n",
|
||
|
"plt.xlim(0,1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Do we want to think in terms of percentage targeting instead?\n",
|
||
|
"\n",
|
||
|
"If so, you could \"target\" a percentage, like choose a range producing 1%-5% as outliers."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 193,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<matplotlib.collections.LineCollection at 0x19a401a0af0>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 193,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEKCAYAAADw2zkCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAmgUlEQVR4nO3deZgdZZn+8e/dS7qzdANJujGQBEJANg2BdIDgMog4yKq4EFBUQInbqPxEnFHRGfcZ3BhRGeLg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Cfpi8Br+5rbYCjPZ9BrfS/kV2hL183MqlGxM4NjgW6SgtHSxzLkta2bC9kXkc2suhWbz+Ax4L8k3R8R15YwU9XoPTNY7NtLzazKFZv28viIuBDYQ9LuG+93MxHrmoZ8R5GZVbti1wx6h50YVYog1ai5sZ6thje6mcjMql6xZqJz0p9f3Zw3ltQM3Ao0pZ9zRUT8++a8VyVzL2QzqwVZhrA+Q1KrpEZJN0haLOn4DO/dCRwUEXsBU4G3S9p/C/NWHE9/aWa1IMtAdf8cEcuBI4BngJ2B0wZ6USRWpg8b0yU2M2fFam9pdjORmVW9LMWgtynpcOAXEbEs65tLqpd0L7AIuC4i7uzjObMkzZM0b/HixVnfumIkQ1J0kozybWZWnbIUg6slPQpMA26Q1AZkaheJiO6ImAqMB/aV9Lo+njM7IjoioqOtrW0ToleGtpYm1nT1sPzlrnJHMTPbbAMWg4j4N+AAoCMi1pLMePaOTfmQiPgHcBPw9s3IWNF8e6mZ1YIsF5DfC6yNiG5Jp5PMf7xdhte1Sdo6XR8OvA14dMviVp5290I2sxqQpZnoyxGxQtIbgYOBc4G
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sns.lineplot(x=np.linspace(0.001,10,100),y=outlier_percent)\n",
|
||
|
"plt.ylabel(\"Percentage of Points Classified as Outliers\")\n",
|
||
|
"plt.xlabel(\"Epsilon Value\")\n",
|
||
|
"plt.ylim(0,5)\n",
|
||
|
"plt.xlim(0,2)\n",
|
||
|
"plt.hlines(y=1,xmin=0,xmax=2,colors='red',ls='--')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 194,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgo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IliYnoEXp9CeVMPXp+Phk47r2ys4cdLxvDM2n1cNDUFm0nL7oYe7nm7BICLpqZw9oREnllTxZzcGOJsBsYkWukecPO53c2snBgKk22kRpkob+olPdqMdvDOoNvuGvZ+W3ud2F3HtxhdMO8APMCPFUXZIoSwAJuFEB8pilIcxJgkSQoiTUoKqohwfJ1dgWOquDg0KcMHe9UqgUGrDvSnB65x0OKrs8Yl8J/P94ECl89MZ/kq/wyfXy8rpCDZxr8/rSAvwcrEtHDyEmzkxltZXdrC5qoOAJZOTub3rxfT2e9vkFOiTNw0L4vfvrqTpAgTO2q7uXxmGstXVnLRtFRe33RgFuBL62uwGLQU13ezqaoDIeD7i/L4+welDK41491t9XzrjBz++XE5Pzt3LOdMTKLX4SEjJowwg5o+x4EGf3Zu9HH99g9BnAWkKEqjoihbBv/eC5QAScGK51i9//775OXlkZ2dzT333BPscCRpVNKkphL5xBNocnL8jwsKiHz8UdQJ8cPOjbUa+NaC7CHH4m0G0qJN7N9zSadWYdZruKAomVibntvOyCEt2ky4ScfLgwO+N8zN5D/rqlm+qpJn1lZRmBLO6WP83TJOj5eDF/PWtg9Q2tCDxaClz+EmN97Cpr0dpEab2V3XNSzGbTWdZMdZyI6z8KMlY3G6fdw0L5ulU5IB/xjGvtZ+Yix61pa18uqmWm749+f88qXtfG/RmMCMptm50dxxVh5GnXrYaxyLk2IMQAiRDkwC1h/iZ7cCtwKkpg7/FnAy8Hq93H777Xz
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# How to find a good epsilon?\n",
|
||
|
"dbscan = DBSCAN(eps=0.4)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Do we want to think in terms of number of outliers targeting instead?\n",
|
||
|
"\n",
|
||
|
"If so, you could \"target\" a number of outliers, such as 3 points as outliers."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 203,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<matplotlib.collections.LineCollection at 0x19a40070670>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 203,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAh6ElEQVR4nO3deZxddX3/8dd7lmRmkswkMwkUSGLCgFhEZBmWJJa1KChCiwhaQyvSxqVVqLZWWpCfP/qr/aFFtCo1ZS+U/hCwLIJCWYUgkCAQAVkSlgTCEpYkkD35/P44Z8JkmZuTmXvvuXPP+/l4nMc995w753wuy3zme77f7+eriMDMzIqrIe8AzMwsX04EZmYF50RgZlZwTgRmZgXnRGBmVnBOBGZmBVexRCDpIkmvSvptn2Odkm6V9HT6OqZS9zczs2wq2SK4BDhyk2PfAG6LiF2B29L3ZmaWI1VyQpmkScCNEbFH+v5J4JCIWCRpB+DOiNitYgGYmdlWNVX5fttHxKJ0/2Vg+/4+KGkGMANgxIgR+77vfe8rayBLV6zh+TeWs8t2I2ltbizrtc3MasGcOXMWR8S4rX2u2olgg4gISf02RyJiJjAToKenJ2bPnl3W+8+at5g/+ff7uXDGgRy4c1dZr21mVgskPZ/lc9UeNfRK+kiI9PXVKt9/g/aWZgCWrFiTVwhmZjWh2ongeuDP0v0/A66r8v036Gh1IjAzg8o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wfkzSInjhjeU5R2JmVh1ZylCfKqldiQskPSTpw9UILg8tzY2MGzWcBU4EZlYQWWoNfS4ilgIfBrqAk4B/rmhUOZswppUFbzoRmFkxZEkESl8/Clw
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sns.lineplot(x=np.linspace(0.001,10,100),y=number_of_outliers)\n",
|
||
|
"plt.ylabel(\"Number of Points Classified as Outliers\")\n",
|
||
|
"plt.xlabel(\"Epsilon Value\")\n",
|
||
|
"plt.ylim(0,10)\n",
|
||
|
"plt.xlim(0,6)\n",
|
||
|
"plt.hlines(y=3,xmin=0,xmax=10,colors='red',ls='--')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 204,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABV0klEQVR4nO3dd5hU1f348feZXnZmtvdeYXfpS0epCtgQe+8ajekmMYn5Jj9TNTExxZhEI9GoscXeKyBFet9dtrO99zb9/v6YZWBdRBCWYZnzeh6eh7l7585nBvZ85p7yOUJRFCRJkqTgowp0AJIkSVJgyAQgSZIUpGQCkCRJClIyAUiSJAUpmQAkSZKClCbQARyPyMhIJTU1NdBhSJIkjSnbt29vUxQl6vPHx1QCSE1NZdu2bYEOQ5IkaUwRQlQf6bjsApIkSQpSMgFIkiQFKZkAJEmSgtSYGgM4EpfLRV1dHXa7PdChHDODwUBiYiJarTbQoUiSFM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4MBMPXTOFtCjf7JysWAsPXjWZaOvIhi/aauBrizKHHYu1GUiJNHFwzyWdWoVZr+HigkSibXruWpxFSqSZUJOOl4YGfG+en85/N1azam0FT2+oIj8plLPH+bplHG4Phy/mrW0foKShB4tBS5/dRXashW2VHSRHmims6xoR466aTjJjLGTGWPje8vE4XF5uXZDJimmJgG8M40BrP1EWPRtKW3llWy03//MzfvLibr61dJx/RtPc7Ei+eW4ORp16xGuciNNiDEAIkQpMATYf4Wd3AHcAJCePnPJ1OvB4PNx99918+OGHJCY
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# How to find a good epsilon?\n",
|
||
|
"dbscan = DBSCAN(eps=0.75)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Minimum Samples\n",
|
||
|
"\n",
|
||
|
" | min_samples : int, default=5\n",
|
||
|
" | The number of samples (or total weight) in a neighborhood for a point\n",
|
||
|
" | to be considered as a core point. This includes the point itself.\n",
|
||
|
" \n",
|
||
|
"\n",
|
||
|
"How to choose minimum number of points?\n",
|
||
|
"\n",
|
||
|
"https://stats.stackexchange.com/questions/88872/a-routine-to-choose-eps-and-minpts-for-dbscan"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 218,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"outlier_percent = []\n",
|
||
|
"\n",
|
||
|
"for n in np.arange(1,100):\n",
|
||
|
" \n",
|
||
|
" # Create Model\n",
|
||
|
" dbscan = DBSCAN(min_samples=n)\n",
|
||
|
" dbscan.fit(two_blobs_outliers)\n",
|
||
|
" \n",
|
||
|
" # Log percentage of points that are outliers\n",
|
||
|
" perc_outliers = 100 * np.sum(dbscan.labels_ == -1) / len(dbscan.labels_)\n",
|
||
|
" \n",
|
||
|
" outlier_percent.append(perc_outliers)\n",
|
||
|
" "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 226,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"Text(0.5, 0, 'Minimum Number of Samples')"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 226,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEHCAYAAACp9y31AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAArrElEQVR4nO3deXwV9dXH8c9h30EgIKvsIKCoREXBpYrWrS6tu1atVq1Lq9a6tfapWu3TqrVVn2pLqxaLtSqgVbTWDaUqimGXTdkXgYQ9LCHbef6YoYZAbobkTm5y7/f9euV178ydO78zGV6HyW9+c37m7oiISOaol+oARESkZinxi4hkGCV+EZEMo8QvIpJhlPhFRDKMEr+ISIZpENeOzexp4Awg190Hh+vaAi8APYClwPnuvrGyfbVv39579OgRV6giImlp6tSp69w9q/x6i2scv5kdC2wFni2T+B8ENrj7r83sTmA/d7+jsn1lZ2d7Tk5OLHGKiKQrM5vq7tnl18fW1ePuk4AN5VafBYwO348Gzo6rfRER2bua7uPv6O6rw/drgI413L6ISMZL2c1dD/qYKuxnMrNrzCzHzHLy8vJqMDIRkfRW04l/rZl1Aghfcyva0N1HuXu2u2dnZe1xb0JERKqo0sRvZueZWcvw/d1mNt7MDqtie68Cl4fvLwf+WcX9iIhIFUW54v+5u+e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Eo3ueARoCY4Dh8YYmIpJcnyxezx3jZrFs/XYuHdadO04ZkOqQUiLKFf85wKHANAB3/8rMWib+iohI7bF1ZzG//tc8xnyynO5tm/H81cM4qne7VIeVMlESf6G7u5k5gJk1jzkmEZGk+XjhOm4
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sns.lineplot(x=np.arange(1,100),y=outlier_percent)\n",
|
||
|
"plt.ylabel(\"Percentage of Points Classified as Outliers\")\n",
|
||
|
"plt.xlabel(\"Minimum Number of Samples\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 229,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABV20lEQVR4nO3dd3iT19n48e/RlmxJ3ntPsM02m4SZABkQsvdO2jTdK23ztu+v803btGmbNG0zaGazmr0HAcLe0zZeGO+9h7ae3x8yAseEQMAIo/O5rlxX9OjRo1sCzq3njPsIRVGQJEmSgo8q0AFIkiRJgSETgCRJUpCSCUCSJClIyQQgSZIUpGQCkCRJClKaQAdwMqKiopS0tLRAhyFJkjSq7Nixo01RlOjPHx9VCSAtLY3t27cHOgxJkqRRRQhRfazjsgtIkiQpSMkEIEmSFKRkApAkSQpSo2oM4FhcLhd1dXXY7fZAh3LCDAYDSUlJaLXaQIciSVIQG/UJoK6uDrPZTFpaGkKIQIfzpRRFob29nbq6OtLT0wMdjiRJQWzUJwC73T5qGn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QaLitMIsaq556F2aRGhRBm0vHK4IDvbXMz+M/GalaureTZDVUUJIdx/hhft4zD7eHoxby17QOUNvRgNmjps7vIiTOz/WAHKVEhFNV1DYtxd00nWbFmsmLNfH/pWBwuL3fMy2L5lCTAN4ZxqLWfaLOeDWWtvLa9ltv+tYmfvbyHby8e45/RNDsnim9dmItRpx72HqfirBgDEEKkAZOALcd47m7gboCUlOFTvs4GHo+He++9l48//pi
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"num_dim = two_blobs_outliers.shape[1]\n",
|
||
|
"\n",
|
||
|
"dbscan = DBSCAN(min_samples=2*num_dim)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 230,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABV0klEQVR4nO3dd5hU1f348feZXnZmtvdeYXfpS0epCtgQe+8ajekmMYn5Jj9TNTExxZhEI9GoscXeKyBFet9dtrO99zb9/v6YZWBdRBCWYZnzeh6eh7l7585nBvZ85p7yOUJRFCRJkqTgowp0AJIkSVJgyAQgSZIUpGQCkCRJClIyAUiSJAUpmQAkSZKClCbQARyPyMhIJTU1NdBhSJIkjSnbt29vUxQl6vPHx1QCSE1NZdu2bYEOQ5IkaUwRQlQf6bjsApIkSQpSMgFIkiQFKZkAJEmSgtSYGgM4EpfLRV1dH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ue++9R05ODpmZmTzwwAOBDkeSxqT4MBMPXTOFtCjf7JysWAsPXjWZaOvIhi/aauBrizKHHYu1GUiJNHFwzyWdWoVZr+HigkSibXruWpxFSqSZUJOOl4YGfG+en85/N1azam0FT2+oIj8plLPH+bplHG4Phy/mrW0foKShB4tBS5/dRXashW2VHSRHmims6xoR466aTjJjLGTGWPje8vE4XF5uXZDJimmJgG8M40BrP1EWPRtKW3llWy03//MzfvLibr61dJx/RtPc7Ei+eW4ORp16xGuciNNiDEAIkQpMATYf4Wd3AHcAJCePnPJ1OvB4PNx99918+OGHJCY
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"num_dim = two_blobs_outliers.shape[1]\n",
|
||
|
"\n",
|
||
|
"dbscan = DBSCAN(eps=0.75,min_samples=2*num_dim)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 231,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABaOklEQVR4nO3dd3hUVfrA8e+ZPplMeiGNhCT03psIiKjYe++FteyKvazlt6urYtdV1GXtFV17pQgogiIiPaH39J7MZPrM+f0xYSCEnoQB5nyeh0fm5M6ZdwZz3rnnnvseIaVEURRFiTyacAegKIqihIdKAIqiKBFKJQBFUZQIpRKAoihKhFIJQFEUJULpwh3AwUhKSpI5OTnhDkNRFOWo8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174pw5M1QvKOqSS6i77XYC1dVA8F4B6x23U/e3SWizs/H88SfRE2+g4fkXsFx1JY73Pwi9duMbb6KJicG7bBmeBQtACGL/8TD1/3w0NK3k+PQzYu65m5onJhM3+QmiLjifQENDsBjdbtc9jCeOQ5ua2roPeDdhWwUkpSyVUi5p+rsNWA0clbfPXnvttaSkpNCrV69wh6IoRzVdx44kvPUWus6dg4979iThjf+iTevQ4lhthw5Y7767eVtGBrr8vOC6fUAYjQhrNJbLL0OTkYH1vnvR5eWhTUik8c23ALBOuhX7a//B9sKL2F55FcPAgZhOPhkA6XKBdud3bv+mzfhWrETExiIbGtD16olr/nx0ebkt5/kB96JF6Lt3R9ejO7GPPkLA6cJ6x+1EXXpJ8ACPB9/6DWg7dMA1ezb2996ncsJp1N5
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"dbscan = DBSCAN(min_samples=1)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 232,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABXYUlEQVR4nO3dd3hUVfrA8e+ZXpNJryQhCb33JgIiKth7V6xrW3tdy2/Xil3Xupa117VXmqgIioj0hN7TSE9mkulzfn9MGAihQxhwzud5fGRu7tx5ZyDnnXvKe4SUEkVRFCX2aKIdgKIoihIdKgEoiqLEKJUAFEVRY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G9cqrICW2Ky7H+Uz4O6bj2acx9OuH87HH0ffqhX3IEAw9e2Lo0QP31KmRekGWc8+l/sabCNXUAOG1Avabb6L+7zegzc3F98ef2K68gsann8F68UU0v/te5LWbXv8vmrg4/AsX4ps9G4Qg/p/30fCvByLdSs2ffErc7bdR+8gkHJMewXLmGYQaG8PF6LYb9zAePRZtWtr+fcDbidosIClluZRyfsufncAy4LBcPnvppZeSmppKz549ox2KohzWdDk5JL7xBrpOncKPe/Qg8fVX0WaktzlXm56O/bbbWh/LykJXWBCetw8IoxFht2G94Hw0WVnY77wDXUEB2sQkmv77BgD2G67H9fJ/cD7zLM4XX8IwYACmY48FQHo8oN36nTu4dh2BxUsQ8fHIxkZ0PXvgmTULXUF+235+wDt3Lvpu3dB170b8A/cTcnuw33wTlvPODZ/g8xFYtRptejqeH37A9c67VI0/nrqrriL
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"dbscan = DBSCAN(eps=0.75,min_samples=1)\n",
|
||
|
"display_categories(dbscan,two_blobs_outliers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"----"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"anaconda-cloud": {},
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.8.5"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 1
|
||
|
}
|