Repository: incubator-systemml Updated Branches: refs/heads/master 931fbbcb4 -> 259742c40
[SYSTEMML-1606] Update notebook samples with latest code Removed SystemML setup instructions from most of the notebooks. Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/259742c4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/259742c4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/259742c4 Branch: refs/heads/master Commit: 259742c400287d2dbc85ca30631f06af7e33cf43 Parents: 931fbbc Author: Arvind Surve <ac...@yahoo.com> Authored: Sun May 21 11:05:12 2017 -0700 Committer: Arvind Surve <ac...@yahoo.com> Committed: Sun May 21 11:05:12 2017 -0700 ---------------------------------------------------------------------- samples/jupyter-notebooks/Autoencoder.ipynb | 69 ++------------- .../Linear_Regression_Algorithms_Demo.ipynb | 89 +++----------------- .../SystemML-PySpark-Recommendation-Demo.ipynb | 58 +------------ samples/jupyter-notebooks/tutorial1.ipynb | 21 ++--- 4 files changed, 27 insertions(+), 210 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/259742c4/samples/jupyter-notebooks/Autoencoder.ipynb ---------------------------------------------------------------------- diff --git a/samples/jupyter-notebooks/Autoencoder.ipynb b/samples/jupyter-notebooks/Autoencoder.ipynb index 0290b12..e69ca9c 100644 --- a/samples/jupyter-notebooks/Autoencoder.ipynb +++ b/samples/jupyter-notebooks/Autoencoder.ipynb @@ -12,39 +12,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Install SystemML Python package and jar file\n", - "You can install SystemML Python tgz file either from \n", - " 1. Distribution location (https://dist.apache.org/repos/dist/release/incubator/systemml/) or \n", - " 2. Latest daily built code (https://sparktc.ibmcloud.com/repo/latest/) or\n", - " 3. From your local system if you have extracted recent code and built locally. \n", - " (e.g. ~/git/incubator-systemml/target/systemml-1.0.0-incubating-SNAPSHOT-python.tgz)\n", - " \n", "### This notebook is supported with SystemML 0.14.0 and above." ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "# !pip install --user systemml>=0.14.0\n", - "\n", - "!pip install https://dist.apache.org/repos/dist/release/incubator/systemml/0.14.0-incubating/systemml-0.14.0-incubating-python.tgz\n", - " \n", - "# !pip install https://sparktc.ibmcloud.com/repo/latest/systemml-1.0.0-incubating-SNAPSHOT-python.tgz\n", - " \n", - "# !pip install ~/git/incubator-systemml/target/systemml-1.0.0-incubating-SNAPSHOT-python.tgz" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "!pip show systemml" @@ -53,9 +27,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", @@ -95,9 +67,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "X_pd = pd.DataFrame(range(1, 2001,1),dtype=float).values.reshape(100,20)\n", @@ -111,9 +81,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "!ls -l /tmp/data/Input" @@ -122,9 +90,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "autoencoderURL = \"https://raw.githubusercontent.com/apache/incubator-systemml/master/scripts/staging/autoencoder-2layer.dml\"\n", @@ -144,9 +110,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "!ls -l /tmp/data/Output" @@ -163,7 +127,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true, "scrolled": true }, "outputs": [], @@ -182,26 +145,6 @@ "\n", "print (iter, num_iters_per_epoch, beg, end, o)" ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "## Uninstall/Clean up SystemML Python package and jar file" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "!yes | pip uninstall systemml" - ] } ], "metadata": { http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/259742c4/samples/jupyter-notebooks/Linear_Regression_Algorithms_Demo.ipynb ---------------------------------------------------------------------- diff --git a/samples/jupyter-notebooks/Linear_Regression_Algorithms_Demo.ipynb b/samples/jupyter-notebooks/Linear_Regression_Algorithms_Demo.ipynb index b39d271..77843ad 100644 --- a/samples/jupyter-notebooks/Linear_Regression_Algorithms_Demo.ipynb +++ b/samples/jupyter-notebooks/Linear_Regression_Algorithms_Demo.ipynb @@ -4,6 +4,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "# Linear Regression Algorithms using Apache SystemML\n", + "\n", "This notebook shows:\n", "- Install SystemML Python package and jar file\n", " - pip\n", @@ -25,13 +27,6 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Install SystemML Python package and jar file\n", - "You can install SystemML Python tgz file either from \n", - " 1. Distribution location (https://dist.apache.org/repos/dist/release/incubator/systemml/) or \n", - " 2. Latest daily built code (https://sparktc.ibmcloud.com/repo/latest/) or\n", - " 3. From your local system if you have extracted recent code and built locally. \n", - " (e.g. ~/git/incubator-systemml/target/systemml-1.0.0-incubating-SNAPSHOT-python.tgz)\n", - " \n", "### This notebook is supported with SystemML 0.14.0 and above." ] }, @@ -39,25 +34,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true, - "scrolled": false - }, - "outputs": [], - "source": [ - "# !pip install --user systemml>=0.14.0\n", - "\n", - "!pip install https://dist.apache.org/repos/dist/release/incubator/systemml/0.14.0-incubating/systemml-0.14.0-incubating-python.tgz\n", - " \n", - "# !pip install https://sparktc.ibmcloud.com/repo/latest/systemml-1.0.0-incubating-SNAPSHOT-python.tgz\n", - " \n", - "# !pip install ~/git/incubator-systemml/target/systemml-1.0.0-incubating-SNAPSHOT-python.tgz" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true, "scrolled": true }, "outputs": [], @@ -75,9 +51,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from systemml import MLContext, dml, dmlFromResource\n", @@ -92,9 +66,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "ml.execute(dml(\"\"\"s = 'Hello World!'\"\"\").output(\"s\")).get(\"s\")" @@ -161,9 +133,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "prog = dml(script).input('$nr', 1e5).output('s')\n", @@ -196,9 +166,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "prog = dml(script).input('$nr', 1e6).output('s')\n", @@ -239,9 +207,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "diabetes = datasets.load_diabetes()\n", @@ -258,9 +224,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "diabetes.data.shape" @@ -330,7 +294,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true, "scrolled": true }, "outputs": [], @@ -413,7 +376,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true, "scrolled": false }, "outputs": [], @@ -497,7 +459,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true, "scrolled": false }, "outputs": [], @@ -518,9 +479,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import os\n", @@ -543,9 +502,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "plt.scatter(diabetes_X_train, diabetes_y_train, color='black')\n", @@ -584,9 +541,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "regr = LinearRegression(sqlCtx)\n", @@ -608,9 +563,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "# Use the trained model to perform prediction\n", @@ -620,24 +573,6 @@ "\n", "plt.plot(diabetes_X_test, predictions, color='black')" ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Uninstall/Clean up SystemML Python package and jar file" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "!yes | pip uninstall systemml" - ] } ], "metadata": { http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/259742c4/samples/jupyter-notebooks/SystemML-PySpark-Recommendation-Demo.ipynb ---------------------------------------------------------------------- diff --git a/samples/jupyter-notebooks/SystemML-PySpark-Recommendation-Demo.ipynb b/samples/jupyter-notebooks/SystemML-PySpark-Recommendation-Demo.ipynb index e706329..f51ef6c 100644 --- a/samples/jupyter-notebooks/SystemML-PySpark-Recommendation-Demo.ipynb +++ b/samples/jupyter-notebooks/SystemML-PySpark-Recommendation-Demo.ipynb @@ -18,39 +18,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Install SystemML Python package and jar file\n", - "You can install SystemML Python tgz file either from \n", - " 1. Distribution location (https://dist.apache.org/repos/dist/release/incubator/systemml/) or \n", - " 2. Latest daily built code (https://sparktc.ibmcloud.com/repo/latest/) or\n", - " 3. From your local system if you have extracted recent code and built locally. \n", - " (e.g. ~/git/incubator-systemml/target/systemml-1.0.0-incubating-SNAPSHOT-python.tgz)\n", - " \n", "### This notebook is supported with SystemML 0.14.0 and above." ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "# !pip install --user systemml>=0.14.0\n", - "\n", - "!pip install https://dist.apache.org/repos/dist/release/incubator/systemml/0.14.0-incubating/systemml-0.14.0-incubating-python.tgz\n", - " \n", - "# !pip install https://sparktc.ibmcloud.com/repo/latest/systemml-1.0.0-incubating-SNAPSHOT-python.tgz\n", - " \n", - "# !pip install ~/git/incubator-systemml/target/systemml-1.0.0-incubating-SNAPSHOT-python.tgz" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "!pip show systemml" @@ -84,9 +58,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "%%sh\n", @@ -98,9 +70,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "# Load data\n", @@ -195,9 +165,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "# Plot training loss over time\n", @@ -208,24 +176,6 @@ "plt.ylabel('Loss')\n", "plt.title('PNMF Training Loss')" ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Uninstall/Clean up SystemML Python package and jar file" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "!yes | pip uninstall systemml" - ] } ], "metadata": { http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/259742c4/samples/jupyter-notebooks/tutorial1.ipynb ---------------------------------------------------------------------- diff --git a/samples/jupyter-notebooks/tutorial1.ipynb b/samples/jupyter-notebooks/tutorial1.ipynb index ce47cf8..83c1999 100644 --- a/samples/jupyter-notebooks/tutorial1.ipynb +++ b/samples/jupyter-notebooks/tutorial1.ipynb @@ -12,14 +12,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Install SystemML Python package and jar file\n", - "You can configre SystemML jar file in Scala kernel by downloading either from \n", - " 1. Distribution location (https://dist.apache.org/repos/dist/release/incubator/systemml/) or \n", - " 2. Latest daily built code (https://sparktc.ibmcloud.com/repo/latest/) or\n", - " 3. From your local system if you have extracted recent code and built locally. \n", - " (e.g. ~/git/incubator-systemml/target/systemml-1.0.0-incubating-SNAPSHOT.jar)\n", + "# Install SystemML jar file and configure kernel\n", " \n", - "Please visit SystemML site to know \"How to configure Toree(Scala) Kernel\".\n", + "Please visit http://systemml.apache.org/install-systemml.html site to know \"How to configure Toree(Scala) Kernel\".\n", " \n", "### This notebook is supported with SystemML 0.14.0 and above." ] @@ -27,9 +22,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import org.apache.sysml.api.mlcontext.MLContext\n", @@ -54,9 +47,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "val sumScript = \"\"\"\n", @@ -81,9 +72,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "outMatrix.show"