Touch-ups in examples and doc
This commit is contained in:
parent
b1d9448908
commit
35bcd5a45a
@ -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:
|
Alternatively, you can feed batches to your model manually:
|
||||||
```python
|
```python
|
||||||
model.train(X_batch, Y_batch)
|
model.train_on_batch(X_batch, Y_batch)
|
||||||
```
|
```
|
||||||
|
|
||||||
Evaluate your performance in one line:
|
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)
|
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).
|
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.
|
- 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.
|
- 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.
|
- 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).
|
- 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 (κέρας) 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."_
|
> _"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."_
|
||||||
|
|
||||||
|
@ -303,11 +303,11 @@ model.add(RepeatVector(2)) # output shape: (nb_samples, 2, 10)
|
|||||||
keras.layers.core.Merge(models, mode='sum')
|
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__:
|
- __Arguments__:
|
||||||
- __models__: List of `Sequential` models.
|
- __layers__: List of layers or [containers](/layers/containers/).
|
||||||
- __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).
|
- __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__:
|
- __Example__:
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
np.random.seed(1337) # for reproducibility
|
||||||
|
|
||||||
from keras.models import Sequential
|
from keras.models import Sequential
|
||||||
from keras.layers.core import Dense, Dropout, Activation
|
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)
|
This demonstrates how to reach a score of 0.4890 (local validation)
|
||||||
on the Kaggle Otto challenge, with a deep net using Keras.
|
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:
|
Recommended to run on GPU:
|
||||||
Command: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python kaggle_otto_nn.py
|
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
|
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):
|
def load_data(path, train=True):
|
||||||
df = pd.read_csv(path)
|
df = pd.read_csv(path)
|
||||||
X = df.values.copy()
|
X = df.values.copy()
|
||||||
@ -121,4 +120,3 @@ print("Generating submission...")
|
|||||||
|
|
||||||
proba = model.predict_proba(X_test)
|
proba = model.predict_proba(X_test)
|
||||||
make_submission(proba, ids, encoder, fname='keras-otto.csv')
|
make_submission(proba, ids, encoder, fname='keras-otto.csv')
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from keras.utils import np_utils
|
|||||||
arXiv:1504.00941v2 [cs.NE] 7 Apr 201
|
arXiv:1504.00941v2 [cs.NE] 7 Apr 201
|
||||||
http://arxiv.org/pdf/1504.00941v2.pdf
|
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.
|
improvement.
|
||||||
|
|
||||||
0.80 train/test accuracy and 0.55 train/test loss after 70 epochs
|
0.80 train/test accuracy and 0.55 train/test loss after 70 epochs
|
||||||
|
Loading…
Reference in New Issue
Block a user