Dev commits

master
agibsonccc 2021-02-01 14:31:20 +09:00
parent 2aa2a8be40
commit 65c6a9a42e
6512 changed files with 418111 additions and 92754 deletions

34
.github/lock.yml vendored
View File

@ -1,34 +0,0 @@
# Configuration for lock-threads - https://github.com/dessant/lock-threads
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 30
# Issues and pull requests with these labels will not be locked. Set to `[]` to disable
exemptLabels: []
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
# Assign `resolved` as the reason for locking. Set to `false` to disable
setLockReason: false
# Limit to only `issues` or `pulls`
only: issues
# Optionally, specify configuration settings just for `issues` or `pulls`
# issues:
# exemptLabels:
# - help-wanted
# lockLabel: outdated
# pulls:
# daysUntilLock: 30
# Repository to extend settings from
# _extends: repo

58
ADRs/0002-ONNX_Runtime.md Normal file
View File

@ -0,0 +1,58 @@
# Onnx runtime module
## Status
Proposed
Proposed by: Adam Gibson (23-09-2020)
Discussed with: saudet
## Context
We need a way of providing nd4j a way of running onnx modules
that is easily compatible with the onnx community. The gold standard for this
is is using [onnxruntime](https://github.com/microsoft/onnxruntime/blob/master/docs/Java_API.md).
## Decision
We will use javacpp's onnxruntime bindings in a similar manner to [nd4j-tensorflow](../nd4j-tensorflow)
allowing nd4j to be used as an ndarray format that interops with onnxruntime.
We will implement a simple api similar to the [GraphRunner](../nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/graphrunner/GraphRunner.java)
This will sit on top of javacpp's lower level onnxruntime bindings.
This module will follow a similar structure to the nd4j-tensorflow module
focusing on INDArrays as a data interchange format, but otherwise pass execution
down to onnxruntime.
The main api to the graph runner works as follows:
```java
try(GraphRunner runner = new GraphRunner(...)) {
Map<String,INDArray> inputs = new HashMap<>();
// ..initialize inputs
Map<String,INDArray> outputs = runner.run(inputs);
// process outputs...
}
```
The core logic will contain the following components:
1. Loading onnx pb files
2. A graph runner in similar nature to nd4j-tensorflow
3. Interop with onnxruntime's version of an ndarray/tensor
Using different accelerators/backends
-----------------------------------------
Similar to nd4j-tensorflow which uses javacpp for the specific version of
tensorflow to use, this module will rely on the user picking the right dependency
to link against. Different builds of cpu, gpu, .. exist [here](https://repo1.maven.org/maven2/org/bytedeco/tensorflow/1.15.3-1.5.4/)
The equivalent of this in onnxruntime can be found [here](https://repo1.maven.org/maven2/org/bytedeco/onnxruntime/1.4.0-1.5.4/)
The user will need to include the version of onnxruntime they wish to use
similar to how you link against a particular implementation in a c library
or include a backend in nd4j. This will happen via maven.

251
ADRs/0003-Import_IR.md Normal file
View File

@ -0,0 +1,251 @@
# Import IR
## Status
Proposed
Proposed by: Adam Gibson (28-09-2020)
Discussed with: Paul Dubs
## Context
Currently, there is a gap in the way samediff/nd4j operations are implemented
vs. how other frameworks represent their models.
Keras, Tensorflow, and Pytorch use an attribute based format with names. Interop
between Onnx ,Tensorflow, and Keras tends to follow the following formula:
1. Map names to equivalent names in the other framework for each operation
configuration. Names being both op names and associated attributes of the
operations such as in Conv2D where you have strides, kernel sizes.
2. Map input/output tensors to the equivalent tensor type in each framework.
3. Setup the complete graph in the equivalent framework. Sometimes the
framework's concepts don't map 1 to 1. They should output equivalent results
regardless though. In order to do this, sometimes the framework needs to
add/remove operations in order to produce equivalent output in a different
graph. The [tensorflow onnx import](https://github.com/onnx/tensorflow-onnx#how-tf2onnx-works)
is a good example of this.
Samediff/nd4j have their internal op representations as a set of ordered
arguments for execution in the form of:
1. t arguments: floating point arguments (float, double,..)
2. integer arguments: integer arguments (long, integer)
3. boolean argument: boolean arguments
4. data type arguments: data types for input/output
5. input arguments: ndarrays for input
6. output arguments: often optional (dynamically created) output ndarray
arguments. If the user wants to pass in outputs to control memory, they are
allowed to do so.
7. axis arguments: Integer arguments that represent the dimension(s) for an
operation to be executed on.
[Reference implementation](https://github.com/KonduitAI/deeplearning4j/blob/master/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/DynamicCustomOp.java#L58)
This maps well enough for execution, but not for file formats.
## Related Work
This may encourage future work to be done to the
[samediff file format](https://github.com/KonduitAI/deeplearning4j/blob/master/nd4j/ADRs/0001-SameDiff_File_Format.md).
Implementation of serialization of file format via flatbuffers can be found
[here](https://github.com/eclipse/deeplearning4j/blob/master/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L4748)
Of note here for prior work is the
[current code generation]
(https://github.com/KonduitAI/dl4j-dev-tools/blob/master/codegen/src/main/ops/org/nd4j/codegen/ops/CNN.kt#L28)
The definitions for the kotlin dsl can be found
[here](https://github.com/KonduitAI/dl4j-dev-tools/blob/master/codegen/src/main/kotlin/org/nd4j/codegen/dsl/OpBuilder.kt)
While it does have the intended description,
its kotlin specific and is only available for a very small subset
of the ops where pre-created objects were created
for specific operations. The goal of this ADR is to expand upon
that and make it language agnostic by providing this information in a
neutral file format that has code generation with it.
Current code generation efforts can be augmented using this file format.
More on this decision making can be found [here](https://github.com/KonduitAI/dl4j-dev-tools/blob/master/codegen/adr/0007-configuration_objects.md)
## Proposal
We expose a symbol based mapping in libnd4j in protobuf format, similar to how
other frameworks are doing it, as a bridge/intermediary format.
This makes it easier to implement interop with the other frameworks, because it
adds the necessary information that is needed to be able to define a direct
mapping.
This could be a future file format depending on how the framework evolves. For
now, this is considered a work around for making writing import code easier/more
portable.
Similar to [ONNX](https://onnx.ai/) and [Tensorflow](https://tensorflow.org/)
we use protobuf to express an attribute based file format and map
samediff/nd4j operations to this format.
We use a translation layer that handles mapping from attributes to the ordered
arguments approach reflected in samediff/nd4j.
For each operation, we define a mapping process to/from this attribute format to the
order based execution format.
A separate but similar set of rules are used for mapping ndarrays.
This attribute based format is an Intermediary Representation that we then
"compile" to the equivalent calls in libnd4j.
The format definitions for the IR can be found [here](./src/main/proto/nd4j/nd4j.proto)
## Consequences
Migration to an attribute based import format makes working with other deep
learning frameworks easier in the future.
### Drawbacks
1. Yet another file format.
2. Risk migrating to new file format in the future.
3. A lot of up front manual work to index set of current operations.
4. Backwards compatibility: yet another thing to maintain. We wrote converters
for any forward compatibility. We address this by specifying an opset schema
scheme similar to onnx.
### Advantages
1. Easy to maintain.
2. Backwards compatible.
3. Easily interops with existing other deep learning frameworks.
4. No additional dependencies from what's already normal.
5. Protobuf allows easy code generation for other languages.
6. Industry standard conventions being used over proprietary tooling reducing
friction for adoption for people coming from other frameworks
7. Straightforward mapping of arguments for import
8. Provide an easy bridge to existing libnd4j
9. Allow automation of op descriptors in any language that would understand how
to pass data to the c++ library.
## Appendix A: Comparison with other Frameworks, implicit vs. explicit
We can find the existing attributes from the conventions of the
libnd4j code base. The libnd4j [conv1d.cpp](https://github.com/KonduitAI/deeplearning4j/blob/master/libnd4j/include/ops/declarable/generic/nn/convo/conv1d.cpp#L104)
file contains the following declaration:
```
auto inputShapeInfo = inputShape->at(0);
auto weightsShapeInfo = inputShape->at(1);
Nd4jLong const* biasShapeInfo = block.width() > 2 ? inputShape->at(2) : nullptr;
int kW = INT_ARG(0) > 0 ? INT_ARG(0) : static_cast<int>(shape::sizeAt(weightsShapeInfo, 0)); // filter(kernel) width
int sW = INT_ARG(1); // strides width
int pW = INT_ARG(2); // paddings width
int dW = INT_ARG(3); // dilations width
int paddingMode = INT_ARG(4); // 0-VALID, 1-SAME
int isNCW = block.getIArguments()->size() > 5 ? !INT_ARG(5) : 1; // INT_ARG(4): 1-NWC, 0-NCW
int wFormat = block.getIArguments()->size() > 6 ? INT_ARG(6) : 0; // 0 - [kW, iC, oC], 1 - [oC, iC, kW], 2 - [oC, kW, iC]
```
We can see that there are macros in the libnd4j code base, which reflect how
each argument is accessed. Each list of arguments has an expected order, that we
need to explicitly map to a parseable structure.
In comparison, the
[onnx Convolution operator](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Conv)
has *explicit* attributes of various types such as lists of ints and named
tensors.
As shown above, these concepts exist internally in the operations and layers
themselves in nd4j/samediff, but they are not exposed directly to the user.
A theoretical op descriptor from libnd4j is as follows:
```java
private String name;
private int nIn,nOut,tArgs,iArgs;
private boolean inplaceAble;
private List<String> inArgNames;
private List<String> outArgNames;
private List<String> tArgNames;
private List<String> iArgNames;
private List<String> bArgNames;
private OpDeclarationType opDeclarationType;
public enum OpDeclarationType {
CUSTOM_OP_IMPL,
BOOLEAN_OP_IMPL,
LIST_OP_IMPL,
LOGIC_OP_IMPL,
OP_IMPL,
DIVERGENT_OP_IMPL,
CONFIGURABLE_OP_IMPL,
REDUCTION_OP_IMPL,
BROADCASTABLE_OP_IMPL,
BROADCASTABLE_BOOL_OP_IMPL
}
```
It contains all the op declarations and fields associated with a descriptor.
In the libnd4j code base, we represent the op descriptor types above
*implicitly* through validation as well as the different macros present in the
code base representing what an op execution looks like.
Validation for what can be present in the various names can be found
[here](https://github.com/KonduitAI/deeplearning4j/blob/master/libnd4j/include/ops/declarable/impl/DeclarableOp.cpp#L734-L765)
The set of macro declarations in libnd4j can be found
[here](https://github.com/eclipse/deeplearning4j/blob/master/libnd4j/include/system/op_boilerplate.h)
## Appendix B: Format Comparison to other frameworks
An add op in tensorflow looks like:
```
op {
name: "Add"
input_arg {
name: "x"
type_attr: "T"
}
input_arg {
name: "y"
type_attr: "T"
}
output_arg {
name: "z"
type_attr: "T"
}
attr {
name: "T"
type: "type"
allowed_values {
list {
type: DT_BFLOAT16
type: DT_HALF
type: DT_FLOAT
type: DT_DOUBLE
type: DT_UINT8
type: DT_INT8
type: DT_INT16
type: DT_INT32
type: DT_INT64
type: DT_COMPLEX64
type: DT_COMPLEX128
type: DT_STRING
}
}
}
}
```
Onnxs add can be found here
https://github.com/onnx/onnx/blob/master/docs/Operators.md#Add
Onnx and tensorflow are purely attribute based formats.

View File

@ -0,0 +1,196 @@

# Libnd4j NdArray padded buffers, strides for Arm_Compute Library wrapper
## Status
PROPOSED
Proposed by: Abdelrauf (23/09/2020)
Discussed with:
## Context
During the integration process of our library with arm_compute, I faced that our NdArray strides are not flexible. (i.e it cant be set properly without **special and manual handling**).
Let's say our Nd Array shapes are `[3,4,2]` and the last index is moving faster (i.e C order). Then our strides will be `[ 8, 2, 1 ]`.
As far as I know, our last index stride can be different (called as ews), but overall strides should follow the cyclic strict rule of dependency.:
strides[index-1] = strides[index] * shapes[index];
On arm_compute besides strides there is also Padding `{top, right, bottom, left}` that can be used to increase strides and change offsets adn as well as total size. its mostly done for performance reasons. As from above we can see that **its just hosting NdArray shape in the buffer of the bigger NdArray shape**. In arm_compute those paddings applied to last 2 dimensions (on NCHW it will be H and W}. We can define it like this:
newH = pad.top + H + pad.bottom;
newW = pad.left + W + pad.right;
so strides will be calculated for the shape `{N,C, newH, newW}` and offset of the first element will be:
offset = pad.left * strideOfNewW + pad.top * strideOfNewH
## Proposal
Introduce helper functions checking below case :
strides[index-1] >= strides[index] * shapes[index];
Add **generic method for the padded buffer** ( we can simulate arm_compute 2d padding and more)
int paddings[rank] = {...}; // total padding
int paddingOffsets[rank] = {...}; //offset indices of the first element
This could be used to padd ndArray shapes and calculate strides based on it while keeping original shape, paddOffsets could be used to determine the beginning of the first element. Though this interface ismore generic its drawback is that on armcompute its possible to padd 1d into 2D while keeping rank but on this one we should supply 2d with one of its dimensions being 1.
## Consequences
1. All tests that were not tested **against subArray** could break. So they will require a fix
2. Writing additional test cases
### Advantages
- alignment possibility for CPUs where alignment is required for speed and vectorization.
- easier integration with libraries. in the case of arm_compute, the last two dimensions are sometimes padded.
### Disadvantages
- its advantage is not so big for modern CPUs where unaligned vector loads possible
- exposing it for users is not desirable: (excessive usage creates unnecessary memory spaces and performance problems)
- could result in unnecessary complications for some function implementations
- possibility of requiring additional tests and fixes
### Technical details about the addition of this functionality into NdArray
A little investigation showed that the current NdArray actually has constructors to specify strides.
Here is the constructor that could be used
[ShapeDescriptor.h](https://github.com/KonduitAI/deeplearning4j/blob/qwr_armcompute/libnd4j/include/array/ShapeDescriptor.h)
Here are additions into ShapeDescriptor:
- validate() //it willbe used for validation of strides and et cetera. This way we can create NdArray by just using ShapeDescriptor alone. And it will be more flexible with correctness
- allocLength() //returns minimal buffer size for the given strides and shapes. (this was missing on libnd4j side)
- paddedBufferDescriptor(..) //helper method for returning ShapeDescriptor for padded buffer.
#### [NdArrayFactory](https://github.com/KonduitAI/deeplearning4j/blob/qwr_armcompute/libnd4j/include/array/impl/NDArrayFactory.cpp#L39-L80)
The method that is using ShapeDescriptor validation, and ShapeDescriptor paddedBuffer .
Furthermore to indicate that shape of the NdArray is using paddedBuffer we will flag with `ARRAY_HAS_PADDED_BUFFER` . so it will be possible to know if NdArray is padded.
Furthermore, it is still possible to recover Paddings from the allocation size of the padded NdArray. But its not an easy task to get PaddingOffsets from offset and recovered full shape. Thats why it requires storing them. Fortunately, for arm_compute tensors **manual padding** we just need to know **total size and the offset** of the first element. So we dont need to change internals that much
As our padded Buffer follows the strict ews() rule instead of the loose one. Paddings will be obtained from this rule:
strides[index-1] == strides[index] * shapes[index];
pseudo code for C order:
for (int j = rank - 1; j >= 0; j--) {
shapesAfterPadding[j] = strides[j - 1] / strides[j]
}
shapesAfterPadding[0] = buffer.AllocSize / strides[0]
//Paddings for index in 0..rank-1
paddings[index] = shapesAfterPadding[index] - shape[index]
### Technical notes on arm_compute library
The main drive for the above proposal to avoid unnecessary performance and memory allocation. And also we should keep on mind :
- in each newer version of arm_compute there are new implementations in which the padding requirements were removed.
This **can diminish the necessity for the proposed changes** if such versions of the desired functions are implemented.
##### Notes on arm_compute tensors
Arm_compute tensors are mostly 3d 4d with max 6d dimensions.
So lets show C order NdArray({2,2,5,5},)
shapeInfo shapeInfo: [4, 2,2,5,5, 50,25,5,1, 8192,1,99]
of float type and its arm_compute tensor equivalent :
- first of all, we map NdArray dataTypes into arm_compute [armcomputeUtils.cpp#L35-L75](https://github.com/KonduitAI/deeplearning4j/blob/qwr_armcompute/libnd4j/include/ops/declarable/platform/armcompute/armcomputeUtils.cpp#L35-L75)
- it will be with the reversed shape. **`NdArray{n,z,y,x} -> TensorShape{x,y,z,n}`**
-
total length in bytes: 400
shapes: 5,5,2,2,1,1,
strides in bytes: 4,20,100,200,0,0,
strides as elements: (1,5,25,50)
Paddings in arm_compute Tensors. `Padding{left,right, top, bottom}`
As both OpenCL and NEON use vector loads and stores instructions to access the data in buffers, so in order to avoid having special cases to handle for the borders all the images and tensors used in this library must be padded
There are different ways padding can be calculated:
- Accurate padding.
in this case it is importan to configure and then after that to allocate
- auto padding.
It guarantees that the allocation will have enough padding to run any of the provided functions
- no padding
- manual padding
#### how padding affects strides offset and total size
in arm_compute Tensor:
it's 2d {Width Height} can be padded and thats why it affects strides.
Lets show it with the picture:
\ top /
\ _____________________ /
left | ^ | right
| Width |
| <-Height |
| |
| |
----------------------
/ bottom \
/ \
Here is the stride calculation pseudo code for Tensor {x,y,z}
stride_x = element_size(); //float will be 4
stride_y = (padding.left + _tensor_shape[0] + padding.right) * stride_x;
stride_z = (padding.top + _tensor_shape[1] + padding.bottom) * stride_y;
required_offset_first_element = padding.left * stride_x + padding.top * stride_y;
For example: if arm_tensor had `padding: left 0, right 1, top 0, bottom 1` :
total: 576
shapes: 5,5,2,2,1,1,
strides in bytes: 4,24,144,288,0,0,
### Notes on the current wrapper implementation
This is a simple wrapper for arm functions with input and output tensors:
[armcomputeUtils.h#L95-L165](https://github.com/KonduitAI/deeplearning4j/blob/qwr_armcompute/libnd4j/include/ops/declarable/platform/armcompute/armcomputeUtils.h#L85-L133)
From above we could see :
- we had to flag padded NdArrays so that we can use manual padding version of arm_compute Tensors
- when padding information is changed during configure process we **have to copy** our NdArray buffer into **new allocated** arm_tensor buffer. and the same with the output.
- for cases without padding , arm_tensor could use our buffer if its ews()==1.
- its desired to call configure and run separately to avoid multiple configure calls ( this is not discussed here, for now)
## arm_compute wrapper proposal
So from above we can conclude that we have two options:
- creating our NdArray with auto_padding strides and modifying the current wrapper. Still configure will be called foreach run. But with auto padding it is using more memory for small ndarrays
- to be able to use accurate padding properly we should call configure before NdArray memory allocation so that we can import it. For that I should investigate graph, DeclarableOps and NdArrays usage lifecycle.
Here is auto padding:
// Some kernels compute 32 elements at the time, worst case scenario they
// will read 32 values after the last element
extra_pad_x = _tensor_shape.num_dimensions() < 1 ? 0 : 32;
pad_x = _tensor_shape.num_dimensions() < 1 ? 0 : 4;
pad_y = _tensor_shape.num_dimensions() < 2 ? 0 : 4;
PaddingSize(pad_y, pad_x + extra_pad_x, pad_y, pad_x);
## Discussion

275
ADRs/0004-Mapping_IR.md Normal file
View File

@ -0,0 +1,275 @@
# Import IR
## Status
Proposed
Proposed by: Adam Gibson (28-09-2020)
Discussed with: N/A
## Context
Generally, every neural network file format defines a sequence of operations
to execute mathematical operations that comprises a neural network.
Each element in the sequence is a node that contains information such as the
desired operation, and a set of attributes that represent parameters
in to the mathematical function to execute.
In order to write import/export for different frameworks, we need to adapt
an attribute based format from various popular deep learning frameworks.
Nd4j has a different list based format for operation execution arguments.
In the [previous ADR](./Import_IR.md), we added an IR which makes it easier to
interop with other frameworks.
In this ADR, this work is extended to add a file format for
describing lists of operations as MappingRules which allow transformations
from one framework to another.
These transformations manipulate protobuf as input and output Nd4j's
new OpDescriptor format as output.
##Related work
See [the import IR](./0003-Import_IR.md)
## Decision
We implement a mapping process framework that defines transforms on an input file format.
A MappingProcess defines a list of MappingRules which represent a sequence of transformations
on each attribute of an op definition.
To assist in mapping, a mapping context with needed information like rule arguments
for transformation, current node, and whole graph are used as input.
The input is a protobuf file for a specific framework and the output is an op descriptor
described [here](./0003-Import_IR.md).
A MappingRule converts 1 or more attributes in to 1 more or arg definitions. A potential definition
can be found in Appendix E.
Attributes are named values supporting a wide variety of types from floats/doubles
to lists of the same primitive types. See Appendix C for a theoretical definition.
Arg Definitions are the arguments for an OpDescriptor described in [the import IR ADR.](./0003-Import_IR.md)
See Appendix D for a potential definition of arg definitions.
All of this together describes how to implement a framework agnostic
interface to convert between a target deep learning framework and the nd4j format.
## Implementation details
In order to implement proper mapping functionality, a common interface is implemented.
Below are the needed common types for mapping:
1. IRNodeDef: A node definition in a graph
2. IRTensor: A tensor type for mapping
3. IROpList: A list of operations
4. IRAttrDef: An attribute definition
5. IRAttrValue: An attribute value
6. IROpDef: An op definition for the IR
7. IRDataType: A data type
8. IRGraph: A graph abstraction
Each one of these types is a wrapper around a specific framework's input types
of the equivalent concepts.
Each of these wrappers knows how to convert the specific concepts
in to the nd4j equivalents for interpretation by a mapper which applies
the mapping rules for a particular framework.
Doing this will allow us to share logic between mappers and making 1 implementation of
mapping possible by calling associated getter methods for concepts like data types and nodes.
## Serialization
In order to persist rules using protobuf, all rules will know how to serialize themselves.
A simple serialize() and load() methods are implemented which covers conversion using
interface methods up to the user to implement which describes how to persist the protobuf
representation. This applies to any of the relevant functionality such as rules and processes.
## Custom types
Some types will not map 1 to 1 or are directly applicable to nd4j.
In order to combat this, when an unknown type is discovered during mapping,
adapter functions for specific types must be specified.
Supported types include:
1. Long/Int
2. Double/Float
3. String
4. Boolean
5. Bytes
6. NDArrays
An example:
A Dim in tensorflow can be mapped to a long in nd4j.
Shape Information can be a list of longs or multiple lists depending on the
context.
## Consequences
### Advantages
* Allows a language neutral way of describing a set of transforms necessary
for mapping an set of operations found in a graph from one framework to the nd4j format.
* Allows a straightforward way of writing an interpreter as well as mappers
for different frameworks in nd4j in a standardized way.
* Replaces the old import and makes maintenance of imports/mappers more straightforward.
### Disadvantages
* More complexity in the code base instead of a more straightforward java implementation.
* Risks introducing new errors due to a rewrite
## Appendix A: Contrasting MappingRules with another implementation
We map names and types to equivalent concepts in each framework.
Onnx tensorflow does this with an [attribute converter](https://github.com/onnx/onnx-tensorflow/blob/08e41de7b127a53d072a54730e4784fe50f8c7c3/onnx_tf/common/attr_converter.py)
This is done by a handler (one for each op).
More can be found [here](https://github.com/onnx/onnx-tensorflow/tree/master/onnx_tf/handlers/backend)
## Appendix B: Challenges when mapping nd4j ops
The above formats are vastly different. Onnx and tensorflow
are purely attribute based. Nd4j is index based.
This challenge is addressed by the IR by adding names to each property.
In order to actually map these properties, we need to define rules for doing so.
Examples of why these mapping rules are needed below:
1. Different conventions for the same concept. One example that stands out from conv
is padding. Padding can be represented as a string or have a boolean that says what a string equals.
In nd4j, we represent this as a boolean: isSameMode. We need to do a conversion inline in order
to invoke nd4j correctly.
2. Another issue is implicit concepts. Commonly, convolution requires you to configure a layout
of NWHC (Batch size, Height, Width, Channels)
or NCHW (Batch size, Channels,Height, Width). Tensorflow allows you to specify it,
nd4j also allows you to specify it. Onnx does not.
A more in depth conversation on this specific issue relating to the
2 frameworks can be found [here](https://github.com/onnx/onnx-tensorflow/issues/31)
In order to address these challenges, we introduce a MappingRule allowing
us to define a series of steps to map the input format to the nd4j format
in a language neutral way via a protobuf declaration.
## Appendix C: A theoretical attribute definition
```kotlin
enum class AttributeValueType {
FLOAT,
LIST_FLOAT,
BYTE,
LIST_BYTE,
INT,
LIST_INT,
BOOL,
LIST_BOOL,
STRING,
LIST_STRING
}
interface IRAttribute<ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE> {
fun name(): String
fun floatValue(): Double
fun listFloatValue(): List<Float>
fun byteValue(): Byte
fun listByteValue(): List<Byte>
fun intValue(): Long
fun listIntValue(): List<Long>
fun boolValue(): Boolean
fun listBoolValue(): List<Boolean>
fun attributeValueType(): AttributeValueType
fun internalAttributeDef(): ATTRIBUTE_TYPE
fun internalAttributeValue(): ATTRIBUTE_VALUE_TYPE
}
```
## Appendix D: A theoretical kotlin definition of argument descriptors and op descriptors can be found below:
```kotlin
interface IRArgDef<T,DATA_TYPE> {
fun name(): String
fun description(): String
fun dataType(): IRDataType<DATA_TYPE>
fun internalValue(): T
fun indexOf(): Integer
}
interface IROpDef<T,ARG_DEF_TYPE,DATA_TYPE,ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE> {
fun opName(): String
fun internalValue(): T
fun inputArgs(): List<IRArgDef<ARG_DEF_TYPE,DATA_TYPE>>
fun outputArgs(): List<IRArgDef<ARG_DEF_TYPE,DATA_TYPE>>
fun attributes(): List<IRAttribute<ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE>>
}
```
##Appendix E: A theoretical kotlin definition of Mapping Rules, MappingProcess and ArgDef can be found below:
```kotlin
interface MappingProcess<T,TENSOR_TYPE,ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE,DATA_TYPE> {
fun opName(): String
fun frameworkVersion(): String
fun inputFramework(): String
fun rules(): List<MappingRule<ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE>>
fun applyProcess(inputNode: IRNode<T,TENSOR_TYPE,ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE,DATA_TYPE>): OpDeclarationDescriptor
fun applyProcessReverse(input: OpDeclarationDescriptor): IRNode<T,TENSOR_TYPE,ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE,DATA_TYPE>
fun createDescriptor(argDescriptors: List<OpNamespace.ArgDescriptor>): OpDeclarationDescriptor
}
interface MappingRule<ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE> {
fun name(): String
/**
* Convert 1 or more attributes in to a list of {@link ArgDescriptor}
*/
fun convert(inputs: List<IRAttribute<ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE>> ): List<OpNamespace.ArgDescriptor>
fun convertReverse(input: List<OpNamespace.ArgDescriptor>): List<IRAttribute<ATTRIBUTE_TYPE,ATTRIBUTE_VALUE_TYPE>>
}
```

81
ADRs/0005-Interpreter.md Normal file
View File

@ -0,0 +1,81 @@
# Interpreter
## Status
Proposed
Proposed by: Adam Gibson (28-09-2020)
Discussed with: N/A
## Context
## Decision
An interpreter uses the [import IR](./0003-Import_IR.md) and the [mapping rule IR](./0004-Mapping_IR.md)
to execute and map operations from one framework to nd4j's file format and back.
This also allows execution of different frameworks via conversion in the nd4j engine.
A combination of the 2 allows a uniform interface to be used for the interpreter.
1 or more MappingRules will be used to transform 1 file format to another.
## Mapping Rules Execution
Mapping Rules are named functions that contain the function signature
(input and outputs). These mapping rules are used by the interpreter
to know which functions to execute.
The interpreter has built in implementations of the defined functions
for the desired transforms.
## Import process
An import process is defined for an overall framework.
It maps input graphs to samediff graphs using
specified mapping processes for op names and frameworks.
An import process is all that is needed to create a graph.
Below are the needed concepts for an import process to implement.
## Graph creation
In order for execution to happen, a graph needs to be built.
This happens in java via the samediff builder.
The conversion happens as follows:
input node -> convert node to op descriptor via defined mapping rules -> add op descriptor to graph
The op descriptor is converted to a CustomOp which is then added to the graph via
[addArgsFor](https://github.com/KonduitAI/deeplearning4j/blob/88d3c4867fb87ec760b445c6b9459ecf353cec47/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1078)
This handles declarative graph creation setting dependencies up. Delegation of the graph structure
creation to the existing Samediff library enables the scope of this interpreter to be focused on
mapping operations.
## Custom Sub graphs
One common use case is mapping sub graphs to custom layers. A custom layer can be thought of as a sequence of operations.
In order to map this, a named process can be created. Generally, if you know what ops the sub graph is made of,
you only need to declare a set of rules based on the rules that map individual ops in the existing framework.
## Consequences
### Advantages
* Uses a common interface across different frameworks making maintenance simple
* Allows an easy to maintain abstraction for interop with different file formats
* Allows an easy entry point in to the framework without knowing much about the framework.
### Disadvantages
* Need to ensure compatibility across different frameworks
* Requires extensive testing to ensure proper compatibility
* May not necessarily support all ops people are expecting. This will be addressed
in a new ADR.

34
Jenkinsfile vendored
View File

@ -1,20 +1,22 @@
#!groovy /*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
/******************************************************************************* #!groovy
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
/* /*
To redefine some job/run parameters, To redefine some job/run parameters,

20
NOTICE.txt Normal file
View File

@ -0,0 +1,20 @@
Eclipse Deeplearning4j
Copyright 2021 Eclipse Deeplearning4j Contributors
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This product includes software developed at
* Skymind Inc (Apache 2.0). Copyright (C) 2015-2018 Skymind Inc .
This product includes software developed at
* Konduit KK (Apache 2.0). Copyright (C) 2020.
This product includes software from the Tensorflow Project (Apache 2.0).
* Copyright (C) 2015-2018 Tensorflow Authors.
# https://github.com/onnx/onnx
This product includes software from the Onnx Project project (Apache 2.0).
* Copyright (C) 2020 Onnx Contributors (https://github.com/onnx/onnx)

View File

@ -1,105 +0,0 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2015-2018 Skymind, Inc.
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License, Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0.
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
~
~ SPDX-License-Identifier: Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>arbiter</artifactId>
<groupId>org.deeplearning4j</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>arbiter-core</artifactId>
<packaging>jar</packaging>
<name>arbiter-core</name>
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-api</artifactId>
<version>${nd4j.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>${commons.math.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${jodatime.version}</version>
</dependency>
<!-- ND4J Shaded Jackson Dependency -->
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>jackson</artifactId>
<version>${nd4j.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-common-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>test-nd4j-native</id>
</profile>
<profile>
<id>test-nd4j-cuda-11.0</id>
</profile>
</profiles>
</project>

View File

@ -1,40 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.api.evaluation;
import org.deeplearning4j.arbiter.optimize.api.data.DataProvider;
import java.io.Serializable;
import java.util.List;
/**
* ModelEvaluator: Used to conduct additional evaluation.
* For example, this may be classification performance on a test set or similar
*/
public interface ModelEvaluator extends Serializable {
Object evaluateModel(Object model, DataProvider dataProvider);
/**
* @return The model types supported by this class
*/
List<Class<?>> getSupportedModelTypes();
/**
* @return The datatypes supported by this class
*/
List<Class<?>> getSupportedDataTypes();
}

View File

@ -1,37 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.api.saving;
import org.deeplearning4j.arbiter.optimize.api.OptimizationResult;
import org.nd4j.shade.jackson.annotation.JsonTypeInfo;
import java.io.IOException;
/**
* Idea: We can't store all results in memory in general (might have thousands of candidates with millions of
* parameters each)
* So instead: return a reference to the saved result. Idea is that the result may be saved to disk or a database,
* and we can easily load it back into memory (if/when required) using the getResult() method
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
public interface ResultReference {
OptimizationResult getResult() throws IOException;
Object getResultModel() throws IOException;
}

View File

@ -1,42 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic;
import lombok.Data;
/**
* Candidates are stored as Chromosome in the population model
*
* @author Alexandre Boulanger
*/
@Data
public class Chromosome {
/**
* The fitness score of the genes.
*/
protected final double fitness;
/**
* The genes.
*/
protected final double[] genes;
public Chromosome(double[] genes, double fitness) {
this.genes = genes;
this.fitness = fitness;
}
}

View File

@ -1,45 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;
import org.deeplearning4j.arbiter.optimize.generator.genetic.population.PopulationModel;
/**
* Abstract class for all crossover operators
*
* @author Alexandre Boulanger
*/
public abstract class CrossoverOperator {
protected PopulationModel populationModel;
/**
* Will be called by the selection operator once the population model is instantiated.
*/
public void initializeInstance(PopulationModel populationModel) {
this.populationModel = populationModel;
}
/**
* Performs the crossover
*
* @return The crossover result. See {@link CrossoverResult}.
*/
public abstract CrossoverResult crossover();
}

View File

@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;
import lombok.Data;
/**
* Returned by a crossover operator
*
* @author Alexandre Boulanger
*/
@Data
public class CrossoverResult {
/**
* If false, there was no crossover and the operator simply returned the genes of a random parent.
* If true, the genes are the result of a crossover.
*/
private final boolean isModified;
/**
* The genes returned by the operator.
*/
private final double[] genes;
public CrossoverResult(boolean isModified, double[] genes) {
this.isModified = isModified;
this.genes = genes;
}
}

View File

@ -1,44 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.parentselection;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.List;
/**
* Abstract class for all parent selection behaviors
*
* @author Alexandre Boulanger
*/
public abstract class ParentSelection {
protected List<Chromosome> population;
/**
* Will be called by the crossover operator once the population model is instantiated.
*/
public void initializeInstance(List<Chromosome> population) {
this.population = population;
}
/**
* Performs the parent selection
*
* @return An array of parents genes. The outer array are the parents, and the inner array are the genes.
*/
public abstract double[][] selectParents();
}

View File

@ -1,25 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.parentselection;
/**
* Abstract class for all parent selection behaviors that selects two parents.
*
* @author Alexandre Boulanger
*/
public abstract class TwoParentSelection extends ParentSelection {
}

View File

@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.culling;
import org.deeplearning4j.arbiter.optimize.generator.genetic.population.PopulationModel;
/**
* The cull operator will remove from the population the least desirables chromosomes.
*
* @author Alexandre Boulanger
*/
public interface CullOperator {
/**
* Will be called by the population model once created.
*/
void initializeInstance(PopulationModel populationModel);
/**
* Cull the population to the culled size.
*/
void cullPopulation();
/**
* @return The target population size after culling.
*/
int getCulledSize();
}

View File

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.exceptions;
public class GeneticGenerationException extends RuntimeException {
public GeneticGenerationException(String message) {
super(message);
}
}

View File

@ -1,33 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.mutation;
/**
* The mutation operator will apply a mutation to the given genes.
*
* @author Alexandre Boulanger
*/
public interface MutationOperator {
/**
* Performs a mutation.
*
* @param genes The genes to be mutated
* @return True if the genes were mutated, otherwise false.
*/
boolean mutate(double[] genes);
}

View File

@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.population;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.ArrayList;
import java.util.List;
/**
* A population initializer that build an empty population.
*
* @author Alexandre Boulanger
*/
public class EmptyPopulationInitializer implements PopulationInitializer {
/**
* Initialize an empty population
*
* @param size The maximum size of the population.
* @return The initialized population.
*/
@Override
public List<Chromosome> getInitializedPopulation(int size) {
return new ArrayList<>(size);
}
}

View File

@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.population;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.List;
/**
* An initializer that construct the population used by the population model.
*
* @author Alexandre Boulanger
*/
public interface PopulationInitializer {
/**
* Called by the population model to construct the population
*
* @param size The maximum size of the population
* @return An initialized population
*/
List<Chromosome> getInitializedPopulation(int size);
}

View File

@ -1,35 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.generator.genetic.population;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.List;
/**
* A listener that is called when the population changes.
*
* @author Alexandre Boulanger
*/
public interface PopulationListener {
/**
* Called after the population has changed.
*
* @param population The population after it has changed.
*/
void onChanged(List<Chromosome> population);
}

View File

@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.runner;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* Simple helper class to store status of a candidate that is/has been/will be executed
*/
@AllArgsConstructor
@Data
public class CandidateInfo {
public CandidateInfo() {
//No arg constructor for Jackson
}
private int index;
private CandidateStatus candidateStatus;
private Double score;
private long createdTime;
private Long startTime;
private Long endTime;
private double[] flatParams; //Same as parameters in Candidate class
private String exceptionStackTrace;
}

View File

@ -1,24 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.runner;
/**
* Status for candidates
*/
public enum CandidateStatus {
Created, Running, Complete, Failed, Cancelled
}

View File

@ -1,40 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.genetic;
import org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.CrossoverOperator;
import org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.CrossoverResult;
import org.deeplearning4j.arbiter.optimize.generator.genetic.population.PopulationModel;
public class TestCrossoverOperator extends CrossoverOperator {
private final CrossoverResult[] results;
private int resultIdx = 0;
public PopulationModel getPopulationModel() {
return populationModel;
}
public TestCrossoverOperator(CrossoverResult[] results) {
this.results = results;
}
@Override
public CrossoverResult crossover() {
return results[resultIdx++];
}
}

View File

@ -1,34 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.genetic;
import org.deeplearning4j.arbiter.optimize.generator.genetic.mutation.MutationOperator;
public class TestMutationOperator implements MutationOperator {
private final boolean[] results;
private int resultIdx = 0;
public TestMutationOperator(boolean[] results) {
this.results = results;
}
@Override
public boolean mutate(double[] genes) {
return results[resultIdx++];
}
}

View File

@ -1,30 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.genetic;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import org.deeplearning4j.arbiter.optimize.generator.genetic.population.PopulationInitializer;
import java.util.ArrayList;
import java.util.List;
public class TestPopulationInitializer implements PopulationInitializer {
@Override
public List<Chromosome> getInitializedPopulation(int size) {
return new ArrayList<>();
}
}

View File

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.optimize.genetic.crossover;
import org.deeplearning4j.BaseDL4JTest;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import org.deeplearning4j.arbiter.optimize.genetic.TestParentSelection;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
public class ParentSelectionTests extends BaseDL4JTest {
@Test
public void ParentSelection_InitializeInstance_ShouldInitPopulation() {
TestParentSelection sut = new TestParentSelection();
List<Chromosome> population = new ArrayList<>();
sut.initializeInstance(population);
Assert.assertSame(population, sut.getPopulation());
}
}

View File

@ -1,83 +0,0 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2015-2018 Skymind, Inc.
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License, Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0.
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
~
~ SPDX-License-Identifier: Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>arbiter</artifactId>
<groupId>org.deeplearning4j</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>arbiter-deeplearning4j</artifactId>
<dependencies>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>arbiter-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>jackson</artifactId>
<version>${nd4j.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-common-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>test-nd4j-native</id>
</profile>
<profile>
<id>test-nd4j-cuda-11.0</id>
</profile>
</profiles>
</project>

View File

@ -1,32 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.scoring;
/**
* Enumeration used to select the type of regression statistics to optimize on, with the various regression score functions
* - MSE: mean squared error<br>
* - MAE: mean absolute error<br>
* - RMSE: root mean squared error<br>
* - RSE: relative squared error<br>
* - CorrCoeff: correlation coefficient<br>
*
* @deprecated Use {@link org.deeplearning4j.eval.RegressionEvaluation.Metric}
*/
@Deprecated
public enum RegressionValue {
MSE, MAE, RMSE, RSE, CorrCoeff
}

View File

@ -1,42 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.multilayernetwork;
import lombok.Data;
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.nd4j.linalg.dataset.api.iterator.DataSetIterator;
import org.nd4j.linalg.dataset.api.iterator.DataSetIteratorFactory;
import java.io.IOException;
/**
* Created by agibsonccc on 3/13/17.
*/
@Data
public class MnistDataSetIteratorFactory implements DataSetIteratorFactory {
/**
* @return
*/
@Override
public DataSetIterator create() {
try {
return new MnistDataSetIterator(1000, 1000);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,69 +0,0 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2015-2018 Skymind, Inc.
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License, Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0.
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
~
~ SPDX-License-Identifier: Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>arbiter</artifactId>
<groupId>org.deeplearning4j</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>arbiter-server</artifactId>
<packaging>jar</packaging>
<name>arbiter-server</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.27</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>arbiter-deeplearning4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-common-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>test-nd4j-native</id>
</profile>
<profile>
<id>test-nd4j-cuda-11.0</id>
</profile>
</profiles>
</project>

View File

@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.server;
import lombok.Data;
import org.deeplearning4j.BaseDL4JTest;
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.nd4j.linalg.dataset.api.iterator.DataSetIterator;
import org.nd4j.linalg.dataset.api.iterator.DataSetIteratorFactory;
import java.io.IOException;
/**
* Created by agibsonccc on 3/13/17.
*/
@Data
public class MnistDataSetIteratorFactory extends BaseDL4JTest implements DataSetIteratorFactory {
/**
* @return
*/
@Override
public DataSetIterator create() {
try {
return new MnistDataSetIterator(1000,1000);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2015-2018 Skymind, Inc.
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License, Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0.
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
~
~ SPDX-License-Identifier: Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>arbiter</artifactId>
<groupId>org.deeplearning4j</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>arbiter-ui</artifactId>
<name>arbiter-ui</name>
<properties>
<java.compile.version>1.8</java.compile.version>
</properties>
<profiles>
<profile>
<id>test-nd4j-native</id>
</profile>
<profile>
<id>test-nd4j-cuda-11.0</id>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>arbiter-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-ui</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-common-tests</artifactId>
<version>${dl4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>arbiter-deeplearning4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${java.compile.version}</source>
<target>${java.compile.version}</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -1,33 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.deeplearning4j.arbiter.ui;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@Data
public class UpdateStatus {
private long statusUpdateTime;
private long settingsUpdateTime;
private long resultsUpdateTime;
}

View File

@ -1,17 +0,0 @@
################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
################################################################################
org.deeplearning4j.arbiter.ui.module.ArbiterModule

View File

@ -1,353 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2015-2018 Skymind, Inc.
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License, Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0.
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
~
~ SPDX-License-Identifier: Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.deeplearning4j</groupId>
<artifactId>arbiter</artifactId>
<packaging>pom</packaging>
<name>Arbiter</name>
<description>Model Evaluation and Testing</description>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<modules>
<module>arbiter-deeplearning4j</module>
<module>arbiter-core</module>
<module>arbiter-server</module>
<module>arbiter-ui</module>
</modules>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<version>2.9</version>
</extension>
</extensions>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.12.1</version>
<configuration>
<configFile>${session.executionRootDirectory}/contrib/formatter.xml</configFile>
<directories>
<directory>arbiter-deeplearning4j</directory>
<directory>arbiter-core</directory>
</directories>
</configuration>
</plugin>
<!-- Configuration for git-commit-id plugin - used with ND4J version check functionality -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>${maven-git-commit-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
<phase>generate-resources</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>
${project.basedir}/target/generated-sources/src/main/resources/ai/skymind/${project.groupId}-${project.artifactId}-git.properties
</generateGitPropertiesFilename>
<gitDescribe>
<skip>true</skip>
</gitDescribe>
</configuration>
</plugin>
<!-- Add generated git.properties files resource directory, for output of git-commit-id plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${maven-build-helper-plugin.version}</version>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>
${project.basedir}/target/generated-sources/src/main/resources
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<executions>
<execution>
<phase>test</phase>
<id>enforce-test-resources</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<skip>${skipTestResourceEnforcement}</skip>
<rules>
<requireActiveProfile>
<profiles>test-nd4j-native,test-nd4j-cuda-11.0</profiles>
<all>false</all>
</requireActiveProfile>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>-Ddtype=double -Dfile.encoding=UTF-8 -Xmx3024m -Xms3024m</argLine>
<!--
By default: Surefire will set the classpath based on the manifest. Because tests are not included
in the JAR, any tests that rely on class path scanning for resources in the tests directory will not
function correctly without this configuratino.
For example, tests for custom layers (where the custom layer is defined in the test directory)
will fail due to the custom layer not being found on the classpath.
http://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html
-->
<useSystemClassLoader>true</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<mavenExecutorId>forked-path</mavenExecutorId>
<!-- To deploy to an open staging repository: -Darguments=-DstagingRepositoryId=orgdeeplearning4j-xxxx -->
<arguments>-Psonatype-oss-release -DskipTests ${arguments}</arguments>
<localCheckout>true</localCheckout>
<pushChanges>false</pushChanges>
</configuration>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${maven-scala-plugin.version}</version>
<configuration>
<args>
<arg>-deprecation</arg>
<arg>-explaintypes</arg>
<arg>-nobootcp</arg>
</args>
</configuration>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>add-source</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.lewisd</groupId>
<artifactId>lint-maven-plugin</artifactId>
<versionRange>[0.0.11,)</versionRange>
<goals>
<goal>check</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<!-- Test coverage -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>test-nd4j-native</id>
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native</artifactId>
<version>${nd4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>dl4j-test-resources</artifactId>
<version>${nd4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>test-nd4j-cuda-11.0</id>
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-cuda-11.0</artifactId>
<version>${nd4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>dl4j-test-resources</artifactId>
<version>${nd4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

View File

@ -1,26 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
# #
# This program and the accompanying materials are made available under the # /* ******************************************************************************
# terms of the Apache License, Version 2.0 which is available at # *
# https://www.apache.org/licenses/LICENSE-2.0. # *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License, Version 2.0 which is available at
# * https://www.apache.org/licenses/LICENSE-2.0.
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# * License for the specific language governing permissions and limitations
# * under the License.
# *
# * SPDX-License-Identifier: Apache-2.0
# ******************************************************************************/
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
################################################################################
# This shell script is adapted from Apache Flink (in turn, adapted from Apache Spark) some modifications. # This shell script is adapted from Apache Flink (in turn, adapted from Apache Spark) some modifications.
set -e set -e
VALID_VERSIONS=( 9.2 10.0 10.1 10.2 11.0 ) VALID_VERSIONS=( 9.2 10.0 10.1 10.2 11.0 11.1 )
usage() { usage() {
echo "Usage: $(basename $0) [-h|--help] <cuda version to be used> echo "Usage: $(basename $0) [-h|--help] <cuda version to be used>
@ -47,6 +49,10 @@ check_cuda_version() {
check_cuda_version "$VERSION" check_cuda_version "$VERSION"
case $VERSION in case $VERSION in
11.1)
VERSION2="8.0"
VERSION3="1.5.5-SNAPSHOT"
;;
11.0) 11.0)
VERSION2="8.0" VERSION2="8.0"
VERSION3="1.5.4" VERSION3="1.5.4"

View File

@ -1,20 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
# #
# This program and the accompanying materials are made available under the # /* ******************************************************************************
# terms of the Apache License, Version 2.0 which is available at # *
# https://www.apache.org/licenses/LICENSE-2.0. # *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License, Version 2.0 which is available at
# * https://www.apache.org/licenses/LICENSE-2.0.
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# * License for the specific language governing permissions and limitations
# * under the License.
# *
# * SPDX-License-Identifier: Apache-2.0
# ******************************************************************************/
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
################################################################################
# This shell script is adapted from Apache Flink (in turn, adapted from Apache Spark) some modifications. # This shell script is adapted from Apache Flink (in turn, adapted from Apache Spark) some modifications.

9
contrib/README.md Normal file
View File

@ -0,0 +1,9 @@
Contrib folder
---------------------------
This folder contains supplementary and retired code for the Eclipse Deeplearning4j project.
1. Attic: These are modules that are no longer maintained, but kept in this repository for posterity.
2. Codegen tools: Supplementary code for generating op definitions, and unit testing utilities for deeplearning4j
proper.

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ /* ******************************************************************************
~ *
~ *
~ * This program and the accompanying materials are made available under the
~ * terms of the Apache License, Version 2.0 which is available at
~ * https://www.apache.org/licenses/LICENSE-2.0.
~ *
~ * Unless required by applicable law or agreed to in writing, software
~ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ * License for the specific language governing permissions and limitations
~ * under the License.
~ *
~ * SPDX-License-Identifier: Apache-2.0
~ ******************************************************************************/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.deeplearning4j</groupId>
<artifactId>arbiter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>arbiter-core</artifactId>
<name>arbiter-core</name>
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-api</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<!-- ND4J Shaded Jackson Dependency -->
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>jackson</artifactId>
</dependency>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>test-nd4j-native</id>
</profile>
<profile>
<id>test-nd4j-cuda-11.0</id>
</profile>
</profiles>
</project>

View File

@ -1,18 +1,20 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <!--
~ Copyright (c) 2015-2018 Skymind, Inc. ~ /* ******************************************************************************
~ ~ *
~ This program and the accompanying materials are made available under the ~ *
~ terms of the Apache License, Version 2.0 which is available at ~ * This program and the accompanying materials are made available under the
~ https://www.apache.org/licenses/LICENSE-2.0. ~ * terms of the Apache License, Version 2.0 which is available at
~ ~ * https://www.apache.org/licenses/LICENSE-2.0.
~ Unless required by applicable law or agreed to in writing, software ~ *
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ~ * Unless required by applicable law or agreed to in writing, software
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ~ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ License for the specific language governing permissions and limitations ~ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ under the License. ~ * License for the specific language governing permissions and limitations
~ ~ * under the License.
~ SPDX-License-Identifier: Apache-2.0 ~ *
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> ~ * SPDX-License-Identifier: Apache-2.0
~ ******************************************************************************/
-->
<assembly> <assembly>
<id>bin</id> <id>bin</id>

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api; package org.deeplearning4j.arbiter.optimize.api;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api; package org.deeplearning4j.arbiter.optimize.api;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api; package org.deeplearning4j.arbiter.optimize.api;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api; package org.deeplearning4j.arbiter.optimize.api;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api; package org.deeplearning4j.arbiter.optimize.api;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api; package org.deeplearning4j.arbiter.optimize.api;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api; package org.deeplearning4j.arbiter.optimize.api;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.adapter; package org.deeplearning4j.arbiter.optimize.api.adapter;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.data; package org.deeplearning4j.arbiter.optimize.api.data;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.data; package org.deeplearning4j.arbiter.optimize.api.data;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.data; package org.deeplearning4j.arbiter.optimize.api.data;

View File

@ -0,0 +1,42 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.evaluation;
import org.deeplearning4j.arbiter.optimize.api.data.DataProvider;
import java.io.Serializable;
import java.util.List;
/**
* ModelEvaluator: Used to conduct additional evaluation.
* For example, this may be classification performance on a test set or similar
*/
public interface ModelEvaluator extends Serializable {
Object evaluateModel(Object model, DataProvider dataProvider);
/**
* @return The model types supported by this class
*/
List<Class<?>> getSupportedModelTypes();
/**
* @return The datatypes supported by this class
*/
List<Class<?>> getSupportedDataTypes();
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.saving; package org.deeplearning4j.arbiter.optimize.api.saving;

View File

@ -0,0 +1,39 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.saving;
import org.deeplearning4j.arbiter.optimize.api.OptimizationResult;
import org.nd4j.shade.jackson.annotation.JsonTypeInfo;
import java.io.IOException;
/**
* Idea: We can't store all results in memory in general (might have thousands of candidates with millions of
* parameters each)
* So instead: return a reference to the saved result. Idea is that the result may be saved to disk or a database,
* and we can easily load it back into memory (if/when required) using the getResult() method
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
public interface ResultReference {
OptimizationResult getResult() throws IOException;
Object getResultModel() throws IOException;
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.saving; package org.deeplearning4j.arbiter.optimize.api.saving;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.score; package org.deeplearning4j.arbiter.optimize.api.score;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.termination; package org.deeplearning4j.arbiter.optimize.api.termination;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.termination; package org.deeplearning4j.arbiter.optimize.api.termination;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.api.termination; package org.deeplearning4j.arbiter.optimize.api.termination;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.config; package org.deeplearning4j.arbiter.optimize.config;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.distribution; package org.deeplearning4j.arbiter.optimize.distribution;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.distribution; package org.deeplearning4j.arbiter.optimize.distribution;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.distribution; package org.deeplearning4j.arbiter.optimize.distribution;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator; package org.deeplearning4j.arbiter.optimize.generator;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator; package org.deeplearning4j.arbiter.optimize.generator;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator; package org.deeplearning4j.arbiter.optimize.generator;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator; package org.deeplearning4j.arbiter.optimize.generator;

View File

@ -0,0 +1,44 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic;
import lombok.Data;
/**
* Candidates are stored as Chromosome in the population model
*
* @author Alexandre Boulanger
*/
@Data
public class Chromosome {
/**
* The fitness score of the genes.
*/
protected final double fitness;
/**
* The genes.
*/
protected final double[] genes;
public Chromosome(double[] genes, double fitness) {
this.genes = genes;
this.fitness = fitness;
}
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic; package org.deeplearning4j.arbiter.optimize.generator.genetic;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover; package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;

View File

@ -0,0 +1,47 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;
import org.deeplearning4j.arbiter.optimize.generator.genetic.population.PopulationModel;
/**
* Abstract class for all crossover operators
*
* @author Alexandre Boulanger
*/
public abstract class CrossoverOperator {
protected PopulationModel populationModel;
/**
* Will be called by the selection operator once the population model is instantiated.
*/
public void initializeInstance(PopulationModel populationModel) {
this.populationModel = populationModel;
}
/**
* Performs the crossover
*
* @return The crossover result. See {@link CrossoverResult}.
*/
public abstract CrossoverResult crossover();
}

View File

@ -0,0 +1,45 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;
import lombok.Data;
/**
* Returned by a crossover operator
*
* @author Alexandre Boulanger
*/
@Data
public class CrossoverResult {
/**
* If false, there was no crossover and the operator simply returned the genes of a random parent.
* If true, the genes are the result of a crossover.
*/
private final boolean isModified;
/**
* The genes returned by the operator.
*/
private final double[] genes;
public CrossoverResult(boolean isModified, double[] genes) {
this.isModified = isModified;
this.genes = genes;
}
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover; package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover; package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover; package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover; package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover;

View File

@ -0,0 +1,46 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.parentselection;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.List;
/**
* Abstract class for all parent selection behaviors
*
* @author Alexandre Boulanger
*/
public abstract class ParentSelection {
protected List<Chromosome> population;
/**
* Will be called by the crossover operator once the population model is instantiated.
*/
public void initializeInstance(List<Chromosome> population) {
this.population = population;
}
/**
* Performs the parent selection
*
* @return An array of parents genes. The outer array are the parents, and the inner array are the genes.
*/
public abstract double[][] selectParents();
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.parentselection; package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.parentselection;

View File

@ -0,0 +1,27 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.parentselection;
/**
* Abstract class for all parent selection behaviors that selects two parents.
*
* @author Alexandre Boulanger
*/
public abstract class TwoParentSelection extends ParentSelection {
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.utils; package org.deeplearning4j.arbiter.optimize.generator.genetic.crossover.utils;

View File

@ -0,0 +1,43 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.culling;
import org.deeplearning4j.arbiter.optimize.generator.genetic.population.PopulationModel;
/**
* The cull operator will remove from the population the least desirables chromosomes.
*
* @author Alexandre Boulanger
*/
public interface CullOperator {
/**
* Will be called by the population model once created.
*/
void initializeInstance(PopulationModel populationModel);
/**
* Cull the population to the culled size.
*/
void cullPopulation();
/**
* @return The target population size after culling.
*/
int getCulledSize();
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.culling; package org.deeplearning4j.arbiter.optimize.generator.genetic.culling;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.culling; package org.deeplearning4j.arbiter.optimize.generator.genetic.culling;

View File

@ -0,0 +1,25 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.exceptions;
public class GeneticGenerationException extends RuntimeException {
public GeneticGenerationException(String message) {
super(message);
}
}

View File

@ -0,0 +1,35 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.mutation;
/**
* The mutation operator will apply a mutation to the given genes.
*
* @author Alexandre Boulanger
*/
public interface MutationOperator {
/**
* Performs a mutation.
*
* @param genes The genes to be mutated
* @return True if the genes were mutated, otherwise false.
*/
boolean mutate(double[] genes);
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.mutation; package org.deeplearning4j.arbiter.optimize.generator.genetic.mutation;

View File

@ -0,0 +1,43 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.population;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.ArrayList;
import java.util.List;
/**
* A population initializer that build an empty population.
*
* @author Alexandre Boulanger
*/
public class EmptyPopulationInitializer implements PopulationInitializer {
/**
* Initialize an empty population
*
* @param size The maximum size of the population.
* @return The initialized population.
*/
@Override
public List<Chromosome> getInitializedPopulation(int size) {
return new ArrayList<>(size);
}
}

View File

@ -0,0 +1,38 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.population;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.List;
/**
* An initializer that construct the population used by the population model.
*
* @author Alexandre Boulanger
*/
public interface PopulationInitializer {
/**
* Called by the population model to construct the population
*
* @param size The maximum size of the population
* @return An initialized population
*/
List<Chromosome> getInitializedPopulation(int size);
}

View File

@ -0,0 +1,37 @@
/*
* ******************************************************************************
* * Copyright (c) 2021 Deeplearning4j Contributors
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.population;
import org.deeplearning4j.arbiter.optimize.generator.genetic.Chromosome;
import java.util.List;
/**
* A listener that is called when the population changes.
*
* @author Alexandre Boulanger
*/
public interface PopulationListener {
/**
* Called after the population has changed.
*
* @param population The population after it has changed.
*/
void onChanged(List<Chromosome> population);
}

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.population; package org.deeplearning4j.arbiter.optimize.generator.genetic.population;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.selection; package org.deeplearning4j.arbiter.optimize.generator.genetic.selection;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2019 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.genetic.selection; package org.deeplearning4j.arbiter.optimize.generator.genetic.selection;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.generator.util; package org.deeplearning4j.arbiter.optimize.generator.util;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.parameter; package org.deeplearning4j.arbiter.optimize.parameter;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.parameter; package org.deeplearning4j.arbiter.optimize.parameter;

View File

@ -1,18 +1,20 @@
/******************************************************************************* /*
* Copyright (c) 2015-2018 Skymind, Inc. * ******************************************************************************
* * * Copyright (c) 2021 Deeplearning4j Contributors
* This program and the accompanying materials are made available under the * *
* terms of the Apache License, Version 2.0 which is available at * * This program and the accompanying materials are made available under the
* https://www.apache.org/licenses/LICENSE-2.0. * * terms of the Apache License, Version 2.0 which is available at
* * * https://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software * *
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * * Unless required by applicable law or agreed to in writing, software
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* License for the specific language governing permissions and limitations * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* under the License. * * License for the specific language governing permissions and limitations
* * * under the License.
* SPDX-License-Identifier: Apache-2.0 * *
******************************************************************************/ * * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.deeplearning4j.arbiter.optimize.parameter.continuous; package org.deeplearning4j.arbiter.optimize.parameter.continuous;

Some files were not shown because too many files have changed in this diff Show More