Skip to content

Commit 7f58b6f

Browse files
committed
Update docs.
1 parent fe8e8fd commit 7f58b6f

File tree

5 files changed

+40
-178
lines changed

5 files changed

+40
-178
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
[![Build Status](https://travis-ci.org/fchollet/keras.svg?branch=master)](https://travis-ci.org/fchollet/keras)
44
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/fchollet/keras/blob/master/LICENSE)
55

6-
# Keras: Deep Learning library for Theano and TensorFlow
7-
86
## You have just found Keras.
97

108
Keras is a high-level neural networks API, written in Python and capable of running on top of either [TensorFlow](https://github.com/tensorflow/tensorflow) or [Theano](https://github.com/Theano/Theano). It was developed with a focus on enabling fast experimentation. *Being able to go from idea to result with the least possible delay is key to doing good research.*
@@ -25,7 +23,7 @@ Keras is compatible with: __Python 2.7-3.5__.
2523

2624
## Guiding principles
2725

28-
- __User friendliness.__ Keras is an API designed for human beings, not machines. It puts user experience front and center. Keras follows best practices for reducing cognitive load: it offers consistent & simple APIs, it minimizes the number user actions required for common use cases, and it provides clear and actionable feedback upon user error.
26+
- __User friendliness.__ Keras is an API designed for human beings, not machines. It puts user experience front and center. Keras follows best practices for reducing cognitive load: it offers consistent & simple APIs, it minimizes the number of user actions required for common use cases, and it provides clear and actionable feedback upon user error.
2927

3028
- __Modularity.__ A model is understood as a sequence or a graph of standalone, fully-configurable modules that can be plugged together with as little restrictions as possible. In particular, neural layers, cost functions, optimizers, initialization schemes, activation functions, regularization schemes are all standalone modules that you can combine to create new models.
3129

@@ -39,7 +37,7 @@ Keras is compatible with: __Python 2.7-3.5__.
3937

4038
## Getting started: 30 seconds to Keras
4139

42-
The core data structure of Keras is a __model__, a way to organize layers. The simplest type of model is the [`Sequential`](http://keras.io/getting-started/sequential-model-guide) model, a linear stack of layers. For more complex architectures, you should use the [Keras functional API](http://keras.io/getting-started/functional-api-guide), allowing to build arbitrary graphs of layers.
40+
The core data structure of Keras is a __model__, a way to organize layers. The simplest type of model is the [`Sequential`](http://keras.io/getting-started/sequential-model-guide) model, a linear stack of layers. For more complex architectures, you should use the [Keras functional API](http://keras.io/getting-started/functional-api-guide), which allows to build arbitrary graphs of layers.
4341

4442
Here is the `Sequential` model:
4543

docs/autogen.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
from keras.layers import advanced_activations
7979
from keras.layers import embeddings
8080
from keras.layers import wrappers
81-
from keras.layers import merge
8281
from keras import optimizers
8382
from keras import callbacks
8483
from keras import models
@@ -228,7 +227,22 @@
228227
},
229228
{
230229
'page': 'layers/merge.md',
231-
'all_module_classes': [merge],
230+
'classes': [
231+
layers.Add,
232+
layers.Multiply,
233+
layers.Average,
234+
layers.Maximum,
235+
layers.Concatenate,
236+
layers.Dot,
237+
],
238+
'functions': [
239+
layers.add,
240+
layers.multiply,
241+
layers.average,
242+
layers.maximum,
243+
layers.concatenate,
244+
layers.dot,
245+
]
232246
},
233247
{
234248
'page': 'layers/wrappers.md',
@@ -408,6 +422,14 @@ def process_function_docstring(docstring):
408422
new_fpath = fpath.replace('templates', 'sources')
409423
shutil.copy(fpath, new_fpath)
410424

425+
# Take care of index page.
426+
readme = open('../README.md').read()
427+
index = open('templates/index.md').read()
428+
index = index.replace('{{autogenerated}}', readme[readme.find('##'):])
429+
f = open('sources/index.md', 'w')
430+
f.write(index)
431+
f.close()
432+
411433
print('Starting autogeneration.')
412434
for page_data in PAGES:
413435
blocks = []
@@ -463,6 +485,10 @@ def process_function_docstring(docstring):
463485
subblocks.append(process_function_docstring(docstring))
464486
blocks.append('\n\n'.join(subblocks))
465487

488+
if not blocks:
489+
raise RuntimeError('Found no content for page ' +
490+
page_data['page'])
491+
466492
mkdown = '\n----\n\n'.join(blocks)
467493
# save module page.
468494
# Either insert content into existing page,

docs/templates/index.md

Lines changed: 1 addition & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -1,171 +1,3 @@
11
# Keras: Deep Learning library for Theano and TensorFlow
22

3-
## You have just found Keras.
4-
5-
Keras is a high-level neural networks API, written in Python and capable of running on top of either [TensorFlow](https://github.com/tensorflow/tensorflow) or [Theano](https://github.com/Theano/Theano). It was developed with a focus on enabling fast experimentation. *Being able to go from idea to result with the least possible delay is key to doing good research.*
6-
7-
Use Keras if you need a deep learning library that:
8-
9-
- Allows for easy and fast prototyping (through user friendliness, modularity, and extensibility).
10-
- Supports both convolutional networks and recurrent networks, as well as combinations of the two.
11-
- Runs seamlessly on CPU and GPU.
12-
13-
Read the documentation at [Keras.io](http://keras.io).
14-
15-
Keras is compatible with: __Python 2.7-3.5__.
16-
17-
18-
------------------
19-
20-
21-
## Guiding principles
22-
23-
- __User friendliness.__ Keras is an API designed for human beings, not machines. It puts user experience front and center. Keras follows best practices for reducing cognitive load: it offers consistent & simple APIs, it minimizes the number user actions required for common use cases, and it provides clear and actionable feedback upon user error.
24-
25-
- __Modularity.__ A model is understood as a sequence or a graph of standalone, fully-configurable modules that can be plugged together with as little restrictions as possible. In particular, neural layers, cost functions, optimizers, initialization schemes, activation functions, regularization schemes are all standalone modules that you can combine to create new models.
26-
27-
- __Easy extensibility.__ New modules are simple to add (as new classes and functions), and existing modules provide ample examples. To be able to easily create new modules allows for total expressiveness, making Keras suitable for advanced research.
28-
29-
- __Work with Python__. No separate models configuration files in a declarative format. Models are described in Python code, which is compact, easier to debug, and allows for ease of extensibility.
30-
31-
32-
------------------
33-
34-
35-
## Getting started: 30 seconds to Keras
36-
37-
The core data structure of Keras is a __model__, a way to organize layers. The simplest type of model is the [`Sequential`](http://keras.io/getting-started/sequential-model-guide) model, a linear stack of layers. For more complex architectures, you should use the [Keras functional API](http://keras.io/getting-started/functional-api-guide), allowing to build arbitrary graphs of layers.
38-
39-
Here is the `Sequential` model:
40-
41-
```python
42-
from keras.models import Sequential
43-
44-
model = Sequential()
45-
```
46-
47-
Stacking layers is as easy as `.add()`:
48-
49-
```python
50-
from keras.layers import Dense, Activation
51-
52-
model.add(Dense(units=64, input_dim=100))
53-
model.add(Activation('relu'))
54-
model.add(Dense(units=10))
55-
model.add(Activation('softmax'))
56-
```
57-
58-
Once your model looks good, configure its learning process with `.compile()`:
59-
60-
```python
61-
model.compile(loss='categorical_crossentropy',
62-
optimizer='sgd',
63-
metrics=['accuracy'])
64-
```
65-
66-
If you need to, you can further configure your optimizer. A core principle of Keras is to make things reasonably simple, while allowing the user to be fully in control when they need to (the ultimate control being the easy extensibility of the source code).
67-
```python
68-
model.compile(loss=keras.losses.categorical_crossentropy,
69-
optimizer=keras.optimizers.SGD(lr=0.01, momentum=0.9, nesterov=True))
70-
```
71-
72-
You can now iterate on your training data in batches:
73-
74-
```python
75-
# x_train and y_train are Numpy arrays --just like in the Scikit-Learn API.
76-
model.fit(x_train, y_train, epochs=5, batch_size=32)
77-
```
78-
79-
Alternatively, you can feed batches to your model manually:
80-
81-
```python
82-
model.train_on_batch(x_batch, y_batch)
83-
```
84-
85-
Evaluate your performance in one line:
86-
87-
```python
88-
loss_and_metrics = model.evaluate(x_test, y_test, batch_size=128)
89-
```
90-
91-
Or generate predictions on new data:
92-
93-
```python
94-
classes = model.predict(x_test, batch_size=128)
95-
```
96-
97-
Building a question answering system, an image classification model, a Neural Turing Machine, or any other model is just as fast. The ideas behind deep learning are simple, so why should their implementation be painful?
98-
99-
For a more in-depth tutorial about Keras, you can check out:
100-
101-
- [Getting started with the Sequential model](http://keras.io/getting-started/sequential-model-guide)
102-
- [Getting started with the functional API](http://keras.io/getting-started/functional-api-guide)
103-
104-
In the [examples folder](https://github.com/fchollet/keras/tree/master/examples) of the repository, you will find more advanced models: question-answering with memory networks, text generation with stacked LSTMs, etc.
105-
106-
107-
------------------
108-
109-
110-
## Installation
111-
112-
Keras uses the following dependencies:
113-
114-
- numpy, scipy
115-
- yaml
116-
- HDF5 and h5py (optional, required if you use model saving/loading functions)
117-
- Optional but recommended if you use CNNs: cuDNN.
118-
119-
120-
*When using the TensorFlow backend:*
121-
122-
- TensorFlow
123-
- [See installation instructions](https://github.com/tensorflow/tensorflow#download-and-setup).
124-
125-
*When using the Theano backend:*
126-
127-
- Theano
128-
- [See installation instructions](http://deeplearning.net/software/theano/install.html#install).
129-
130-
To install Keras, `cd` to the Keras folder and run the install command:
131-
```sh
132-
sudo python setup.py install
133-
```
134-
135-
You can also install Keras from PyPI:
136-
```sh
137-
sudo pip install keras
138-
```
139-
140-
------------------
141-
142-
143-
## Switching from TensorFlow to Theano
144-
145-
By default, Keras will use TensorFlow as its tensor manipulation library. [Follow these instructions](http://keras.io/backend/) to configure the Keras backend.
146-
147-
------------------
148-
149-
150-
## Support
151-
152-
You can ask questions and join the development discussion:
153-
154-
- On the [Keras Google group](https://groups.google.com/forum/#!forum/keras-users).
155-
- On the [Keras Slack channel](https://kerasteam.slack.com). Use [this link](https://keras-slack-autojoin.herokuapp.com/) to request an invitation to the channel.
156-
157-
You can also post **bug reports and feature requests** (only) in [Github issues](https://github.com/fchollet/keras/issues). Make sure to read [our guidelines](https://github.com/fchollet/keras/blob/master/CONTRIBUTING.md) first.
158-
159-
160-
------------------
161-
162-
163-
## Why this name, Keras?
164-
165-
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).
166-
167-
Keras was initially developed as part of the research effort of project ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System).
168-
169-
>_"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."_ Homer, Odyssey 19. 562 ff (Shewring translation).
170-
171-
------------------
3+
{{autogenerated}}

docs/templates/layers/about-keras-layers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ reconstructed_layer = Dense.from_config(config)
1515
Or:
1616

1717
```python
18-
from keras.utils.layer_utils import layer_from_config
18+
from keras import layers
1919

2020
config = layer.get_config()
21-
layer = layer_from_config({'class_name': layer.__class__.__name__,
22-
'config': config})
21+
layer = layers.deserialize({'class_name': layer.__class__.__name__,
22+
'config': config})
2323
```
2424

2525
If a layer has a single node (i.e. if it isn't a shared layer), you can get its input tensor, output tensor, input shape and output shape via:

keras/objectives.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Legacy objectives module.
2+
3+
Only kept for backwards API compatibility.
4+
"""
5+
from __future__ import absolute_import
6+
from .losses import *

0 commit comments

Comments
 (0)