From 35bcd5a45a6599dcd4965bb93936e48cbed60788 Mon Sep 17 00:00:00 2001 From: fchollet Date: Sun, 5 Jul 2015 15:04:20 -0700 Subject: [PATCH] Touch-ups in examples and doc --- docs/sources/index.md | 8 ++++---- docs/sources/layers/core.md | 6 +++--- examples/kaggle_otto_nn.py | 6 ++---- examples/mnist_irnn.py | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/sources/index.md b/docs/sources/index.md index 506eb8816..3bfb3d13f 100644 --- a/docs/sources/index.md +++ b/docs/sources/index.md @@ -67,7 +67,7 @@ model.fit(X_train, Y_train, nb_epoch=5, batch_size=32) Alternatively, you can feed batches to your model manually: ```python -model.train(X_batch, Y_batch) +model.train_on_batch(X_batch, Y_batch) ``` Evaluate your performance in one line: @@ -81,7 +81,7 @@ classes = model.predict_classes(X_test, batch_size=32) proba = model.predict_proba(X_test, batch_size=32) ``` -Building a network of LSTMs, a deep CNN, a word2vec embedder or any other model is just as fast. The ideas behind deep learning are simple, so why should their implementation be painful? +Building a network of LSTMs, a deep CNN, a Neural Turing Machine, a word2vec embedder or any other model is just as fast. The ideas behind deep learning are simple, so why should their implementation be painful? Have a look at the [examples](examples.md). @@ -116,7 +116,7 @@ Keras welcomes all contributions from the community. - Keep a pragmatic mindset and avoid bloat. Only add to the source if that is the only path forward. - New features should be documented. Make sure you update the documentation along with your Pull Request. - The documentation for every new feature should include a usage example in the form of a code snippet. -- All changes should be tested. A formal test process will be introduced very soon. +- All changes should be tested. Make sure any new feature you add has a corresponding unit test. - Even if you don't contribute to the Keras source code, if you have an application of Keras that is concise and powerful, please consider adding it to our collection of [examples](https://github.com/fchollet/keras/tree/master/examples). @@ -124,7 +124,7 @@ Keras welcomes all contributions from the community. Keras (κέρας) means _horn_ in Greek. It is a reference to a literary image from ancient Greek and Latin literature, first found in the _Odyssey_, where dream spirits (_Oneiroi_, singular _Oneiros_) are divided between those who deceive men with false visions, who arrive to Earth through a gate of ivory, and those who announce a future that will come to pass, who arrive through a gate of horn. It's a play on the words κέρας (horn) / κραίνω (fulfill), and ἐλέφας (ivory) / ἐλεφαίρομαι (deceive). -Keras was developed as part of the research effort of project ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System). +Keras was developed as part of the research effort of project __ONEIROS__ (*Open-ended Neuro-Electronic Intelligent Robot Operating System*). > _"Oneiroi are beyond our unravelling --who can be sure what tale they tell? Not all that men look for comes to pass. Two gates there are that give passage to fleeting Oneiroi; one is made of horn, one of ivory. The Oneiroi that pass through sawn ivory are deceitful, bearing a message that will not be fulfilled; those that come out through polished horn have truth behind them, to be accomplished for men who see them."_ diff --git a/docs/sources/layers/core.md b/docs/sources/layers/core.md index 75a8a05d7..b29ba7d27 100644 --- a/docs/sources/layers/core.md +++ b/docs/sources/layers/core.md @@ -303,11 +303,11 @@ model.add(RepeatVector(2)) # output shape: (nb_samples, 2, 10) keras.layers.core.Merge(models, mode='sum') ``` -Merge the output of a list of models into a single tensor, following one of two modes: `sum` or `concat`. +Merge the output of a list of layers (or containers) into a single tensor, following one of two modes: `sum` or `concat`. - __Arguments__: - - __models__: List of `Sequential` models. - - __mode__: String, one of `{'sum', 'concat'}`. `sum` will simply sum the outputs of the models (therefore all models should have an output with the same shape). `concat` will concatenate the outputs along the last dimension (therefore all models should have an output that only differ along the last dimension). + - __layers__: List of layers or [containers](/layers/containers/). + - __mode__: String, one of `{'sum', 'concat'}`. `sum` will simply sum the outputs of the layers (therefore all layers should have an output with the same shape). `concat` will concatenate the outputs along the last dimension (therefore all layers should have an output that only differ along the last dimension). - __Example__: diff --git a/examples/kaggle_otto_nn.py b/examples/kaggle_otto_nn.py index face3333a..da8dc4e9a 100644 --- a/examples/kaggle_otto_nn.py +++ b/examples/kaggle_otto_nn.py @@ -3,6 +3,7 @@ from __future__ import print_function import numpy as np import pandas as pd +np.random.seed(1337) # for reproducibility from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation @@ -17,7 +18,7 @@ from sklearn.preprocessing import StandardScaler This demonstrates how to reach a score of 0.4890 (local validation) on the Kaggle Otto challenge, with a deep net using Keras. - Compatible Python 2.7-3.4 + Compatible Python 2.7-3.4. Requires Scikit-Learn and Pandas. Recommended to run on GPU: Command: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python kaggle_otto_nn.py @@ -35,8 +36,6 @@ from sklearn.preprocessing import StandardScaler Get the data from Kaggle: https://www.kaggle.com/c/otto-group-product-classification-challenge/data ''' -np.random.seed(1337) # for reproducibility - def load_data(path, train=True): df = pd.read_csv(path) X = df.values.copy() @@ -121,4 +120,3 @@ print("Generating submission...") proba = model.predict_proba(X_test) make_submission(proba, ids, encoder, fname='keras-otto.csv') - diff --git a/examples/mnist_irnn.py b/examples/mnist_irnn.py index 5178937e1..59ab29261 100644 --- a/examples/mnist_irnn.py +++ b/examples/mnist_irnn.py @@ -20,7 +20,7 @@ from keras.utils import np_utils arXiv:1504.00941v2 [cs.NE] 7 Apr 201 http://arxiv.org/pdf/1504.00941v2.pdf - Optimizer is replaced with RMSprop which give more stable and steady + Optimizer is replaced with RMSprop which yields more stable and steady improvement. 0.80 train/test accuracy and 0.55 train/test loss after 70 epochs