26 lines
783 B
Markdown
26 lines
783 B
Markdown
|
|
---
|
||
|
|
title: Deeplearning4j Listeners
|
||
|
|
short_title: Listeners
|
||
|
|
description: Adding hooks and listeners on DL4J models.
|
||
|
|
category: Models
|
||
|
|
weight: 5
|
||
|
|
---
|
||
|
|
|
||
|
|
## What are listeners?
|
||
|
|
|
||
|
|
Listeners allow users to "hook" into certain events in Eclipse Deeplearning4j. This allows you to collect or print information useful for tasks like training. For example, a `ScoreIterationListener` allows you to print training scores from the output layer of a neural network.
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
To add one or more listeners to a `MultiLayerNetwork` or `ComputationGraph`, use the `addListener` method:
|
||
|
|
|
||
|
|
```java
|
||
|
|
MultiLayerNetwork model = new MultiLayerNetwork(conf);
|
||
|
|
model.init();
|
||
|
|
//print the score with every 1 iteration
|
||
|
|
model.setListeners(new ScoreIterationListener(1));
|
||
|
|
```
|
||
|
|
|
||
|
|
## Available listeners
|
||
|
|
|
||
|
|
{{autogenerated}}
|