public static class ComputationGraphConfiguration.GraphBuilder extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowDisconnected |
protected boolean |
allowNoOutput |
protected boolean |
backprop |
protected BackpropType |
backpropType |
protected NeuralNetConfiguration.Builder |
globalConfiguration |
protected Map<String,InputPreProcessor> |
inputPreProcessors |
protected List<String> |
networkInputs |
protected List<InputType> |
networkInputTypes |
protected List<String> |
networkOutputs |
protected boolean |
pretrain |
protected int |
tbpttBackLength |
protected int |
tbpttFwdLength |
protected Map<String,List<String>> |
vertexInputs
Key: graph node.
|
protected Map<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(Collection<String> inputNames)
Specify the inputs to the network, and their associated labels.
|
ComputationGraphConfiguration.GraphBuilder |
addInputs(String... inputNames)
Specify the inputs to the network, and their associated labels.
|
ComputationGraphConfiguration.GraphBuilder |
addLayer(String layerName,
Layer layer,
InputPreProcessor preProcessor,
String... layerInputs)
Add a layer and an
InputPreProcessor , with the specified name and specified inputs. |
ComputationGraphConfiguration.GraphBuilder |
addLayer(String layerName,
Layer layer,
String... layerInputs)
Add a layer, with no
InputPreProcessor , with the specified name and specified inputs. |
ComputationGraphConfiguration.GraphBuilder |
addVertex(String vertexName,
GraphVertex vertex,
String... vertexInputs)
Add a
GraphVertex to the network configuration. |
ComputationGraphConfiguration.GraphBuilder |
allowDisconnected(boolean allowDisconnected)
Used only during validation after building.
If true: don't throw an exception on configurations containing vertices that are 'disconnected'. |
ComputationGraphConfiguration.GraphBuilder |
allowNoOutput(boolean allowNoOutput)
Used only during validation after building.
If true: don't throw an exception on configurations without any outputs. |
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
|
Map<String,InputType> |
getLayerActivationTypes()
For the (perhaps partially constructed) network configuration, return a map of activation sizes for each
layer and vertex in the graph.
Note 1: The network configuration may be incomplete, but the inputs have been added to the layer already. Note 2: To use this method, the network input types must have been set using setInputTypes(InputType...)
first |
ComputationGraphConfiguration.GraphBuilder |
inputPreProcessor(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 |
layer(int layerName,
Layer layer,
String... layerInputs)
Add a layer, with no
InputPreProcessor , with the specified name and specified inputs. |
ComputationGraphConfiguration.GraphBuilder |
layer(String layerName,
Layer layer,
InputPreProcessor preProcessor,
String... layerInputs)
Add a layer and an
InputPreProcessor , with the specified name and specified inputs. |
ComputationGraphConfiguration.GraphBuilder |
layer(String layerName,
Layer layer,
String... layerInputs)
Add a layer, with no
InputPreProcessor , with the specified name and specified inputs. |
ComputationGraphConfiguration.GraphBuilder |
pretrain(boolean pretrain)
Whether to do layerwise pre training or not
|
ComputationGraphConfiguration.GraphBuilder |
removeVertex(String vertexName)
Intended for use with the transfer learning API.
|
ComputationGraphConfiguration.GraphBuilder |
removeVertex(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(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 |
ComputationGraphConfiguration.GraphBuilder |
tBPTTLength(int tbpttLength)
When doing truncated backpropagation through time (tBPTT): how many steps should we do?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT) See: http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdf |
protected Map<String,GraphVertex> vertices
protected Map<String,List<String>> vertexInputs
protected boolean pretrain
protected boolean backprop
protected BackpropType backpropType
protected int tbpttFwdLength
protected int tbpttBackLength
protected Map<String,InputPreProcessor> inputPreProcessors
protected NeuralNetConfiguration.Builder globalConfiguration
protected boolean allowDisconnected
protected boolean allowNoOutput
public GraphBuilder(NeuralNetConfiguration.Builder globalConfiguration)
public GraphBuilder(ComputationGraphConfiguration newConf, NeuralNetConfiguration.Builder globalConfiguration)
public ComputationGraphConfiguration.GraphBuilder inputPreProcessor(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 tBPTTLength(int tbpttLength)
tbpttLength
- length > 0public ComputationGraphConfiguration.GraphBuilder addLayer(String layerName, Layer layer, 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 layer(int layerName, Layer layer, 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 layer(String layerName, Layer layer, 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(String layerName, Layer layer, InputPreProcessor preProcessor, 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 layer(String layerName, Layer layer, InputPreProcessor preProcessor, 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(String vertexName)
vertexName
- Name of the vertex to removepublic ComputationGraphConfiguration.GraphBuilder removeVertex(String vertexName, boolean removeConnections)
removeConnections
- Specify true to remove connectionsvertexName
- Name of the vertex to removepublic ComputationGraphConfiguration.GraphBuilder addInputs(String... inputNames)
inputNames
- The names of the inputs. This also defines their orderpublic ComputationGraphConfiguration.GraphBuilder addInputs(Collection<String> inputNames)
inputNames
- The names of the inputs. This also defines their orderpublic ComputationGraphConfiguration.GraphBuilder setInputTypes(InputType... inputTypes)
public ComputationGraphConfiguration.GraphBuilder setOutputs(String... outputNames)
outputNames
- The names of the output layers. This also defines their order.public ComputationGraphConfiguration.GraphBuilder addVertex(String vertexName, GraphVertex vertex, 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.GraphBuilder allowDisconnected(boolean allowDisconnected)
allowDisconnected
- Whether to allow disconnected vertices, during validationpublic ComputationGraphConfiguration.GraphBuilder allowNoOutput(boolean allowNoOutput)
allowNoOutput
- Whether to allow no outputs, during validationpublic Map<String,InputType> getLayerActivationTypes()
setInputTypes(InputType...)
firstpublic ComputationGraphConfiguration build()
Copyright © 2018. All rights reserved.