diff --git a/README.md b/README.md index c1d84e3..283a2e5 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,12 @@ Two important functions are provided for training and prediction: ## Installation -You clone or download this repository and then install via `python setup.py install`, or copy the `mdn` folder into your own project. +This project requires Python 3.6+. You can clone or download this repository and then install via `python setup.py install`, or copy the `mdn` folder into your own project. You can easily install this package directly from Github via `pip` like so: pip install git+git://github.com/cpmpercussion/keras-mdn-layer.git#egg=keras-mdn-layer + And finally, import the `mdn` module in Python: `import mdn` diff --git a/notebooks/MDN-2D-spiral-prediction.ipynb b/notebooks/MDN-2D-spiral-prediction.ipynb index 677eeb1..07e2e97 100644 --- a/notebooks/MDN-2D-spiral-prediction.ipynb +++ b/notebooks/MDN-2D-spiral-prediction.ipynb @@ -142,26 +142,6 @@ "plt.show()" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Sampling Functions\n", - "\n", - "The MDN model outputs parameters of a mixture model---a list of means (mu), variances (sigma), and weights (pi).\n", - "\n", - "The MDN package contains some functions to split up these parameters and sample from the normal distributions that they form.\n", - "\n", - "We use \n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -191,12 +171,12 @@ "# To find points on the graph, we need to sample from each distribution.\n", "\n", "# Split up the mixture parameters (for future fun)\n", - "mus = np.apply_along_axis((lambda a: a[:N_MIXES*OUTPUT_DIMS]),1, y_test)\n", - "sigs = np.apply_along_axis((lambda a: a[N_MIXES*OUTPUT_DIMS:2*N_MIXES*OUTPUT_DIMS]),1, y_test)\n", - "pis = np.apply_along_axis((lambda a: softmax(a[-N_MIXES:])),1, y_test)\n", + "mus = np.apply_along_axis((lambda a: a[:N_MIXES*OUTPUT_DIMS]), 1, y_test)\n", + "sigs = np.apply_along_axis((lambda a: a[N_MIXES*OUTPUT_DIMS:2*N_MIXES*OUTPUT_DIMS]), 1, y_test)\n", + "pis = np.apply_along_axis((lambda a: mdn.softmax(a[-N_MIXES:])), 1, y_test)\n", "\n", "# Sample from the predicted distributions\n", - "y_samples = np.apply_along_axis(sample_from_output, 1, y_test, N_MIXES,OUTPUT_DIMS,temp=1.0)" + "y_samples = np.apply_along_axis(mdn.sample_from_output, 1, y_test, OUTPUT_DIMS, N_MIXES, temp=1.0, sigma_temp=1.0)" ] }, { @@ -254,9 +234,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "venv", "language": "python", - "name": "python3" + "name": "venv" }, "language_info": { "codemirror_mode": { @@ -268,7 +248,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.8" } }, "nbformat": 4,