public static class ComputationGraphConfiguration.GraphBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
backprop |
protected BackpropType |
backpropType |
protected NeuralNetConfiguration.Builder |
globalConfiguration |
protected java.util.Map<java.lang.String,InputPreProcessor> |
inputPreProcessors |
protected java.util.List<java.lang.String> |
networkInputs |
protected java.util.List<InputType> |
networkInputTypes |
protected java.util.List<java.lang.String> |
networkOutputs |
protected boolean |
pretrain |
protected int |
tbpttBackLength |
protected int |
tbpttFwdLength |
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
vertexInputs
Key: graph node.
|
protected java.util.Map<java.lang.String,GraphVertex> |
vertices |
Constructor and Description |
---|
GraphBuilder(ComputationGraphConfiguration newConf,
NeuralNetConfiguration.Builder globalConfiguration) |
GraphBuilder(NeuralNetConfiguration.Builder globalConfiguration) |
Modifier and Type | Method and Description |
---|---|
ComputationGraphConfiguration.GraphBuilder |
addInputs(java.lang.String... inputNames)
Specify the inputs to the network, and their associated labels.
|
ComputationGraphConfiguration.GraphBuilder |
addLayer(java.lang.String layerName,
Layer layer,
InputPreProcessor preProcessor,
java.lang.String... layerInputs)
Add a layer and an
InputPreProcessor , with the specified name and specified inputs. |
ComputationGraphConfiguration.GraphBuilder |
addLayer(java.lang.String layerName,
Layer layer,
java.lang.String... layerInputs)
Add a layer, with no
InputPreProcessor , with the specified name and specified inputs. |
ComputationGraphConfiguration.GraphBuilder |
addVertex(java.lang.String vertexName,
GraphVertex vertex,
java.lang.String... vertexInputs)
Add a
GraphVertex to the network configuration. |
ComputationGraphConfiguration.GraphBuilder |
backprop(boolean backprop)
Whether to do back prop (standard supervised learning) or not
|
ComputationGraphConfiguration.GraphBuilder |
backpropType(BackpropType type)
The type of backprop.
|
ComputationGraphConfiguration |
build()
Create the ComputationGraphConfiguration from the Builder pattern
|
ComputationGraphConfiguration.GraphBuilder |
inputPreProcessor(java.lang.String layer,
InputPreProcessor processor)
Specify the processors for a given layer
These are used at each layer for doing things like normalization and shaping of input.
Note: preprocessors can also be defined using the addLayer(String, Layer, InputPreProcessor, String...) method. |
ComputationGraphConfiguration.GraphBuilder |
pretrain(boolean pretrain)
Whether to do layerwise pre training or not
|
ComputationGraphConfiguration.GraphBuilder |
removeVertex(java.lang.String vertexName)
Intended for use with the transfer learning API.
|
ComputationGraphConfiguration.GraphBuilder |
removeVertex(java.lang.String vertexName,
boolean removeConnections)
Intended for use with the transfer learning API.
|
ComputationGraphConfiguration.GraphBuilder |
setInputTypes(InputType... inputTypes)
Specify the types of inputs to the network, so that:
(a) preprocessors can be automatically added, and (b) the nIns (input size) for each layer can be automatically calculated and set The order here is the same order as .addInputs(). |
ComputationGraphConfiguration.GraphBuilder |
setOutputs(java.lang.String... outputNames)
Set the network output labels.
|
ComputationGraphConfiguration.GraphBuilder |
tBPTTBackwardLength(int backwardLength)
When doing truncated BPTT: how many steps of backward should we do?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT) This is the k2 parameter on pg23 of http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdf |
ComputationGraphConfiguration.GraphBuilder |
tBPTTForwardLength(int forwardLength)
When doing truncated BPTT: how many steps of forward pass should we do
before doing (truncated) backprop?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT) Typically tBPTTForwardLength parameter is same as the tBPTTBackwardLength parameter, but may be larger than it in some circumstances (but never smaller) Ideally your training data time series length should be divisible by this This is the k1 parameter on pg23 of http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdf |
protected java.util.Map<java.lang.String,GraphVertex> vertices
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> vertexInputs
protected java.util.List<java.lang.String> networkInputs
protected java.util.List<InputType> networkInputTypes
protected java.util.List<java.lang.String> networkOutputs
protected boolean pretrain
protected boolean backprop
protected BackpropType backpropType
protected int tbpttFwdLength
protected int tbpttBackLength
protected java.util.Map<java.lang.String,InputPreProcessor> inputPreProcessors
protected NeuralNetConfiguration.Builder globalConfiguration
public GraphBuilder(NeuralNetConfiguration.Builder globalConfiguration)
public GraphBuilder(ComputationGraphConfiguration newConf, NeuralNetConfiguration.Builder globalConfiguration)
public ComputationGraphConfiguration.GraphBuilder inputPreProcessor(java.lang.String layer, InputPreProcessor processor)
addLayer(String, Layer, InputPreProcessor, String...)
method.layer
- the name of the layer that this preprocessor will be used withprocessor
- the preprocessor to use for the specified layerpublic ComputationGraphConfiguration.GraphBuilder backprop(boolean backprop)
backprop
- whether to do back prop or notpublic ComputationGraphConfiguration.GraphBuilder pretrain(boolean pretrain)
pretrain
- whether to do pre train or notpublic ComputationGraphConfiguration.GraphBuilder backpropType(BackpropType type)
type
- Type of backprop. Default: BackpropType.Standardpublic ComputationGraphConfiguration.GraphBuilder tBPTTForwardLength(int forwardLength)
forwardLength
- Forward length > 0, >= backwardLengthpublic ComputationGraphConfiguration.GraphBuilder tBPTTBackwardLength(int backwardLength)
backwardLength
- <= forwardLengthpublic ComputationGraphConfiguration.GraphBuilder addLayer(java.lang.String layerName, Layer layer, java.lang.String... layerInputs)
InputPreProcessor
, with the specified name and specified inputs.layerName
- Name/label of the layer to addlayer
- The layer configurationlayerInputs
- Inputs to this layer (must be 1 or more). Inputs may be other layers, GraphVertex objects,
on a combination of the two.addLayer(String, Layer, InputPreProcessor, String...)
public ComputationGraphConfiguration.GraphBuilder addLayer(java.lang.String layerName, Layer layer, InputPreProcessor preProcessor, java.lang.String... layerInputs)
InputPreProcessor
, with the specified name and specified inputs.layerName
- Name/label of the layer to addlayer
- The layer configurationpreProcessor
- The InputPreProcessor to use with this layer.layerInputs
- Inputs to this layer (must be 1 or more). Inputs may be other layers, GraphVertex objects,
on a combination of the two.public ComputationGraphConfiguration.GraphBuilder removeVertex(java.lang.String vertexName)
vertexName
- Name of the vertex to removepublic ComputationGraphConfiguration.GraphBuilder removeVertex(java.lang.String vertexName, boolean removeConnections)
removeConnections
- Specify true to remove connectionsvertexName
- Name of the vertex to removepublic ComputationGraphConfiguration.GraphBuilder addInputs(java.lang.String... inputNames)
inputNames
- The names of the inputs. This also defines their orderpublic ComputationGraphConfiguration.GraphBuilder setInputTypes(InputType... inputTypes)
public ComputationGraphConfiguration.GraphBuilder setOutputs(java.lang.String... outputNames)
outputNames
- The names of the output layers. This also defines their order.public ComputationGraphConfiguration.GraphBuilder addVertex(java.lang.String vertexName, GraphVertex vertex, java.lang.String... vertexInputs)
GraphVertex
to the network configuration. A GraphVertex defines forward and backward pass methods,
and can contain a LayerVertex
, a ElementWiseVertex
to do element-wise
addition/subtraction, a MergeVertex
to combine/concatenate the activations out of multiple layers or vertices,
a SubsetVertex
to select a subset of the activations out of another layer/GraphVertex.GraphVertex
class) may also be used.vertexName
- The name of the GraphVertex to addvertex
- The GraphVertex to addvertexInputs
- The inputs/activations to this GraphVertexpublic ComputationGraphConfiguration build()