Skip to content

Commit

Permalink
documentation changes and additions for new features
Browse files Browse the repository at this point in the history
  • Loading branch information
jubbens committed Feb 20, 2018
1 parent d1e3b06 commit f11ff44
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For example, using a few lines of code you can easily use your data to train a c

## Example Usage

Train a simple model to classify species:
Train a simple regression model to rate plants for abiotic stress:

```python
import deepplantphenomics as dpp
Expand All @@ -53,17 +53,16 @@ model = dpp.DPPModel(debug=True)
channels = 3

# Setup and hyperparameters
model.set_batch_size(128)
model.set_problem_type('regression')
model.set_batch_size(64)
model.set_image_dimensions(256, 256, channels)
model.set_learning_rate(0.001)
model.set_maximum_training_epochs(700)
model.set_train_test_split(0.75)
model.set_learning_rate(0.0001)
model.set_maximum_training_epochs(100)
model.set_train_test_split(0.8)

# Load dataset
model.load_dataset_from_directory_with_auto_labels('./data')

# Specify pre-processing steps
model.add_preprocessing_step('auto-segmentation')
# Load dataset of images and ground-truth labels
model.load_multiple_labels_from_csv('./data/my_labels.csv')
model.load_images_with_ids_from_directory('./data')

# Simple convolutional neural network model
model.add_input_layer()
Expand All @@ -74,9 +73,6 @@ model.add_pooling_layer(kernel_size=3, stride_length=2)
model.add_convolutional_layer(filter_dimension=[5, 5, 32, 32], stride_length=1, activation_function='relu')
model.add_pooling_layer(kernel_size=3, stride_length=2)

model.add_convolutional_layer(filter_dimension=[5, 5, 32, 64], stride_length=1, activation_function='relu')
model.add_pooling_layer(kernel_size=3, stride_length=2)

model.add_fully_connected_layer(output_size=256, activation_function='relu')

model.add_output_layer()
Expand Down
19 changes: 19 additions & 0 deletions docs/Hyperparameter-Optimization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The performance of the training process is sensitive to different constants called hyperparameters. DPP supports automatic hyperparameter optimization via athe grid search method in order to evaluate performance under many different combinations of hyperparameter values.

## Training with Hyperparameter Search

In order to train with hyperparameter search, you must replace the line

```
model.begin_training()
```

with a modified version containing the ranges of hyperparameters you would like to evaluate:

```
model.begin_training_with_hyperparameter_search(l2_reg_limits=[0.001, 0.005], lr_limits=[0.0001, 0.001], num_steps=4)
```

Here, you can see that we are searching over values for two hyperparameters: the L2 regularization coefficient (`l2_reg_limits`) and the learning rate (`lr_limits`). If you don't want to search over a particular hyperparameter, just set its limits to `None` and make sure you set it manually in your model (for example, with `set_regularization_coefficient()`). The values in brackets indicate the lowest and highest values to try, respectively. The area in between the low and high values is divided into equal parts depending on the number of steps chosen.

The parameter `num_steps=4` means that the system will search over 4 values for each of the two hyperparameters, meaning that in total 12 runs will be executed. Please note that larger values for `num_steps` will increase the amount of runs exponentially, which will increase the run time dramatically.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pages:
- Data Fusion Options: Data-Fusion-Options.md
- Semantic Segmentation: Semantic-Segmentation.md
- Tools: Tools.md
- Hyperparameter Optimization: Hyperparameter-Optimization.md
- Tutorials:
- Tutorial - Training the Leaf Counter: Tutorial-Training-The-Leaf-Counter.md
- Tutorial - Deploying your Trained Model: Tutorial-Deployment.md
Expand Down

0 comments on commit f11ff44

Please sign in to comment.