Skip to content

Commit

Permalink
Merge pull request #1876 from nd-02110114/update-tutorials
Browse files Browse the repository at this point in the history
update tutorials
  • Loading branch information
Bharath Ramsundar committed May 31, 2020
2 parents 48d40fc + eee39f3 commit 4cbaac0
Show file tree
Hide file tree
Showing 19 changed files with 6,980 additions and 5,434 deletions.
327 changes: 170 additions & 157 deletions examples/tutorials/01_The_Basic_Tools_of_the_Deep_Life_Sciences.ipynb

Large diffs are not rendered by default.

183 changes: 95 additions & 88 deletions examples/tutorials/02_Learning_MNIST_Digit_Classifiers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,67 +56,101 @@
"metadata": {
"id": "UXJKRlAv5xFA",
"colab_type": "code",
"colab": {}
"colab": {
"base_uri": "https://localhost:8080/",
"height": 479
},
"outputId": "3a8d973a-9b49-44ea-f7b6-4ad80ffcdba3"
},
"source": [
"%%capture\n",
"%tensorflow_version 1.x\n",
"!wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh\n",
"!chmod +x Miniconda3-latest-Linux-x86_64.sh\n",
"!bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local\n",
"!conda install -y -c deepchem -c rdkit -c conda-forge -c omnia deepchem-gpu=2.3.0\n",
"import sys\n",
"sys.path.append('/usr/local/lib/python3.7/site-packages/')"
"!curl -Lo deepchem_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py\n",
"import deepchem_installer\n",
"%time deepchem_installer.install(version='2.3.0')"
],
"execution_count": 0,
"outputs": []
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"TensorFlow 1.x selected.\n",
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
" Dload Upload Total Spent Left Speed\n",
"100 2814 100 2814 0 0 28140 0 --:--:-- --:--:-- --:--:-- 28140\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"add /root/miniconda/lib/python3.6/site-packages to PYTHONPATH\n",
"python version: 3.6.9\n",
"remove current miniconda\n",
"fetching installer from https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\n",
"done\n",
"installing miniconda to /root/miniconda\n",
"done\n",
"installing deepchem\n",
"done\n",
"/usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/__init__.py:15: FutureWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.\n",
" warnings.warn(msg, category=FutureWarning)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"WARNING:tensorflow:\n",
"The TensorFlow contrib module will not be included in TensorFlow 2.0.\n",
"For more information, please see:\n",
" * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md\n",
" * https://github.com/tensorflow/addons\n",
" * https://github.com/tensorflow/io (for I/O related ops)\n",
"If you depend on functionality not listed there, please file an issue.\n",
"\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"deepchem-2.3.0 installation finished!\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"CPU times: user 2.71 s, sys: 996 ms, total: 3.71 s\n",
"Wall time: 4min 14s\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "hbTulXIP5xFN",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 63
},
"outputId": "ec59ca5d-c872-4de4-af00-fb9ed614d292"
"colab": {}
},
"source": [
"from tensorflow.examples.tutorials.mnist import input_data"
],
"execution_count": 2,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"<p style=\"color: red;\">\n",
"The default version of TensorFlow in Colab will switch to TensorFlow 2.x on the 27th of March, 2020.<br>\n",
"We recommend you <a href=\"https://www.tensorflow.org/guide/migrate\" target=\"_blank\">upgrade</a> now\n",
"or ensure your notebook will continue to use TensorFlow 1.x via the <code>%tensorflow_version 1.x</code> magic:\n",
"<a href=\"https://colab.research.google.com/notebooks/tensorflow_version.ipynb\" target=\"_blank\">more info</a>.</p>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
}
}
]
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "4u9vY8iu5xFU",
"colab_type": "code",
"outputId": "22a37e01-90de-4bd7-ad54-9b8c42333aed",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 530
},
"outputId": "e1e5157e-bce2-4b8a-e398-52b95b546dad"
}
},
"source": [
"# TODO: This is deprecated. Let's replace with a DeepChem native loader for maintainability.\n",
Expand All @@ -127,7 +161,7 @@
{
"output_type": "stream",
"text": [
"WARNING:tensorflow:From <ipython-input-3-a839aeb82f4b>:1: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n",
"WARNING:tensorflow:From <ipython-input-3-227956e9c9c1>:2: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Please use alternatives such as official/mnist/dataset.py from tensorflow/models.\n",
"WARNING:tensorflow:From /tensorflow-1.15.2/python3.6/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.\n",
Expand Down Expand Up @@ -166,42 +200,15 @@
"metadata": {
"id": "MsHJLy-35xFe",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 207
},
"outputId": "037c5709-8e5f-458f-ccce-8e168174e3ca"
"colab": {}
},
"source": [
"import deepchem as dc\n",
"import tensorflow as tf\n",
"from tensorflow.keras.layers import Reshape, Conv2D, Flatten, Dense, Softmax"
],
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": [
"/usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/__init__.py:15: FutureWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.\n",
" warnings.warn(msg, category=FutureWarning)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"WARNING:tensorflow:\n",
"The TensorFlow contrib module will not be included in TensorFlow 2.0.\n",
"For more information, please see:\n",
" * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md\n",
" * https://github.com/tensorflow/addons\n",
" * https://github.com/tensorflow/io (for I/O related ops)\n",
"If you depend on functionality not listed there, please file an issue.\n",
"\n"
],
"name": "stdout"
}
]
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
Expand Down Expand Up @@ -244,11 +251,11 @@
"metadata": {
"id": "Xq9T4trd5xGD",
"colab_type": "code",
"outputId": "fc4384c6-730f-4e8c-a60d-d9708d003bdb",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 275
},
"outputId": "d084c449-863f-45c3-fe62-ac4a91b41d2f"
}
},
"source": [
"model.fit(train, nb_epoch=2)"
Expand All @@ -258,15 +265,15 @@
{
"output_type": "stream",
"text": [
"WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/deepchem/models/keras_model.py:169: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.\n",
"WARNING:tensorflow:From /root/miniconda/lib/python3.6/site-packages/deepchem/models/keras_model.py:169: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.\n",
"\n",
"WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/deepchem/models/optimizers.py:76: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.\n",
"WARNING:tensorflow:From /root/miniconda/lib/python3.6/site-packages/deepchem/models/optimizers.py:76: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.\n",
"\n",
"WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/deepchem/models/keras_model.py:258: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.\n",
"WARNING:tensorflow:From /root/miniconda/lib/python3.6/site-packages/deepchem/models/keras_model.py:258: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.\n",
"\n",
"WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/deepchem/models/keras_model.py:260: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.\n",
"WARNING:tensorflow:From /root/miniconda/lib/python3.6/site-packages/deepchem/models/keras_model.py:260: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.\n",
"\n",
"WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/deepchem/models/keras_model.py:200: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.\n",
"WARNING:tensorflow:From /root/miniconda/lib/python3.6/site-packages/deepchem/models/keras_model.py:200: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.\n",
"\n",
"WARNING:tensorflow:From /tensorflow-1.15.2/python3.6/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
Expand All @@ -293,11 +300,11 @@
"metadata": {
"id": "ZGP9d70u5xGU",
"colab_type": "code",
"outputId": "7ae20e09-7602-42d7-87a4-2510873146f1",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
},
"outputId": "896f006d-bfab-43de-8d64-2f4ee5dfc7e5"
}
},
"source": [
"from sklearn.metrics import roc_curve, auc\n",
Expand All @@ -320,16 +327,16 @@
"output_type": "stream",
"text": [
"Validation\n",
"class 0:auc=0.9999057979948827\n",
"class 1:auc=0.9999335476621387\n",
"class 2:auc=0.9998705637425881\n",
"class 3:auc=0.999911789233876\n",
"class 4:auc=0.9999623237852037\n",
"class 5:auc=0.9998804023326087\n",
"class 6:auc=0.9998620230088834\n",
"class 7:auc=0.9995460674157303\n",
"class 8:auc=0.9998530924048773\n",
"class 9:auc=0.9996017892577271\n"
"class 0:auc=0.9999473577030227\n",
"class 1:auc=0.9999211378882008\n",
"class 2:auc=0.9999187049470992\n",
"class 3:auc=0.9999000878057167\n",
"class 4:auc=0.9999732080250338\n",
"class 5:auc=0.9998869625422123\n",
"class 6:auc=0.9999294587087216\n",
"class 7:auc=0.9998189989785494\n",
"class 8:auc=0.9996727967199541\n",
"class 9:auc=0.9998515678426888\n"
],
"name": "stdout"
}
Expand Down
Loading

0 comments on commit 4cbaac0

Please sign in to comment.