"This notebook provides a playground to explore the sketched cost.\n",
"\n",
"First, you can chose one of three tasks to be solved:\n",
"1. k-means with $k = 1$ (\"1-means\") in dimension $d = 2$\n",
"1. k-means with $k = 2$ (\"1-means\") in dimension $d = 1$\n",
"1. GMM modeling with $k = 1$ in dimension $d = 1$\n",
"\n",
"The code will generate a dataset in the relevant dimension. Note that you can generate different datasets by changing the random seed to change the datasets. Moreover, you can also add \"extra clusters\" in the generated dataset (note that in this case, the value of $k$ used in the cost will not match the truth of the dataset!).\n",
"\n",
"Finally, you can also select the parameters of the sketch: its size ($m$) and the scale parameter ($\\sigma$)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#%matplotlib widget\n",
"%matplotlib notebook\n",
"\n",
"# General imports\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import scipy.stats\n",
"\n",
"# Interactive widget\n",
"from ipywidgets import widgets, interact\n",
"\n",
"# We import the pycle toolbox for sketched learning; we will need three submodules\n",
This notebook provides a playground to explore the sketched cost.
First, you can chose one of three tasks to be solved:
1. k-means with $k = 1$ ("1-means") in dimension $d = 2$
1. k-means with $k = 2$ ("1-means") in dimension $d = 1$
1. GMM modeling with $k = 1$ in dimension $d = 1$
The code will generate a dataset in the relevant dimension. Note that you can generate different datasets by changing the random seed to change the datasets. Moreover, you can also add "extra clusters" in the generated dataset (note that in this case, the value of $k$ used in the cost will not match the truth of the dataset!).
Finally, you can also select the parameters of the sketch: its size ($m$) and the scale parameter ($\sigma$).
%% Cell type:code id: tags:
``` python
#%matplotlib widget
%matplotlibnotebook
# General imports
importnumpyasnp
importmatplotlib.pyplotasplt
importscipy.stats
# Interactive widget
fromipywidgetsimportwidgets,interact
# We import the pycle toolbox for sketched learning; we will need three submodules