Internals
CompositionalNetworks.Layer
— TypeLayer
A structure to store a LittleDict
of operations that can be selected during the learning phase of an ICN. If the layer is exclusive, only one operation can be selected at a time.
Base.length
— Methodlength(layer)
Return the number of operations in a layer.
Base.length
— MethodBase.length(icn)
Return the total number of operations of an ICN.
CompositionalNetworks._compose
— Method_compose(icn)
Internal function called by compose
and show_composition
.
CompositionalNetworks.ag_count_positive
— Methodag_count_positive(x)
Count the number of strictly positive elements of x
.
CompositionalNetworks.ag_sum
— Methodag_sum(x)
Aggregate through +
a vector into a single scalar.
CompositionalNetworks.ar_prod
— Methodar_prod(x)
Reduce k = length(x)
vectors through product to a single vector.
CompositionalNetworks.ar_sum
— Methodar_sum(x)
Reduce k = length(x)
vectors through sum to a single vector.
CompositionalNetworks.as_bitvector
— Functionas_bitvector(n::Int, max_n::Int = n)
Convert an Int to a BitVector of minimal size (relatively to max_n
).
CompositionalNetworks.as_int
— Methodas_int(v::AbstractVector)
Convert a BitVector
into an Int
.
CompositionalNetworks.co_abs_diff_val_param
— Methodco_abs_diff_val_param(x; param)
Return the absolute difference between x
and param
.
CompositionalNetworks.co_abs_diff_val_vars
— Methodco_abs_diff_val_vars(x; nvars)
Return the absolute difference between x
and the number of variables nvars
.
CompositionalNetworks.co_euclidian
— Methodco_euclidian(x; dom_size)
Compute an euclidian norm with domain size dom_size
of a scalar.
CompositionalNetworks.co_euclidian_param
— Methodco_euclidian_param(x; param, dom_size)
Compute an euclidian norm with domain size dom_size
, weigthed by param
, of a scalar.
CompositionalNetworks.co_identity
— Methodco_identity(x)
Identity function. Already defined in Julia as identity
, specialized for scalars in the comparison
layer.
CompositionalNetworks.co_param_minus_val
— Methodco_param_minus_val(x; param)
Return the difference param - x
if positive, 0.0
otherwise.
CompositionalNetworks.co_val_minus_param
— Methodco_val_minus_param(x; param)
Return the difference x - param
if positive, 0.0
otherwise.
CompositionalNetworks.co_val_minus_vars
— Methodco_val_minus_vars(x; nvars)
Return the difference x - nvars
if positive, 0.0
otherwise, where nvars
denotes the numbers of variables.
CompositionalNetworks.co_vars_minus_val
— Methodco_vars_minus_val(x; nvars)
Return the difference nvars - x
if positive, 0.0
otherwise, where nvars
denotes the numbers of variables.
CompositionalNetworks.exclu
— Methodexclu(layer)
Return true
if the layer has mutually exclusive operations.
CompositionalNetworks.functions
— Methodfunctions(layer)
Access the operations of a layer. The container is ordered.
CompositionalNetworks.generate
— Methodgenerate(c::Composition, name, lang)
Generates the code of c
in a specific language lang
.
CompositionalNetworks.generate_inclusive_operations
— Methodgenerate_inclusive_operations(predicate, bits)
generate_exclusive_operation(max_op_number)
Generates the operations (weigths) of a layer with inclusive/exclusive operations.
CompositionalNetworks.generate_weigths
— Methodgenerate_weigths(layers)
generate_weigths(icn)
Generate the weigths of a collection of layers or of an ICN.
CompositionalNetworks.is_viable
— Methodis_viable(layer, w)
is_viable(icn)
is_viable(icn, w)
Assert if a pair of layer/icn and weigths compose a viable pattern. If no weigths are given with an icn, it will check the current internal value.
CompositionalNetworks.layers
— Methodlayers(icn)
Return the ordered layers of an ICN.
CompositionalNetworks.map_tr!
— Methodmap_tr!(f, x, X, param)
Return an anonymous function that applies f
to all elements of x
and store the result in X
, with a parameter param
(which is set to nothing
for function with no parameter).
CompositionalNetworks.nbits_exclu
— Methodnbits_exclu(layer)
Convert the length of an exclusive layer into a number of bits.
CompositionalNetworks.reduce_symbols
— Functionreduce_symbols(symbols, sep)
Produce a formatted string that separates the symbols by sep
. Used internally for show_composition
.
CompositionalNetworks.selected_size
— Methodselected_size(layer, layer_weigths)
Return the number of operations selected by layer_weigths
in layer
.
CompositionalNetworks.show_layer
— Methodshow_layer(layer)
Return a string that contains the elements in a layer.
CompositionalNetworks.symbol
— Methodsymbol(layer, i)
Return the i-th symbols of the operations in a given layer.
CompositionalNetworks.tr_contiguous_vals_minus
— Methodtr_contiguous_vals_minus(i, x)
tr_contiguous_vals_minus(x)
tr_contiguous_vals_minus(x, X::AbstractVector)
Return the difference x[i] - x[i + 1]
if positive, 0.0
otherwise. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_contiguous_vals_minus_rev
— Methodtr_contiguous_vals_minus_rev(i, x)
tr_contiguous_vals_minus_rev(x)
tr_contiguous_vals_minus_rev(x, X::AbstractVector)
Return the difference x[i + 1] - x[i]
if positive, 0.0
otherwise. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_bounding_param
— Methodtr_count_bounding_param(i, x; param)
tr_count_bounding_param(x; param)
tr_count_bounding_param(x, X::AbstractVector; param)
Count the number of elements bounded (not strictly) by x[i]
and x[i] + param
. An extended method to vector with sig (x, param)
is generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_eq
— Methodtr_count_eq(i, x)
tr_count_eq(x)
tr_count_eq(x, X::AbstractVector)
Count the number of elements equal to x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_eq_left
— Methodtr_count_eq_left(i, x)
tr_count_eq_left(x)
tr_count_eq_left(x, X::AbstractVector)
Count the number of elements to the left of and equal to x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_eq_param
— Methodtr_count_eq_param(i, x; param)
tr_count_eq_param(x; param)
tr_count_eq_param(x, X::AbstractVector; param)
Count the number of elements equal to x[i] + param
. Extended method to vector with sig (x, param)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_eq_right
— Methodtr_count_eq_right(i, x)
tr_count_eq_right(x)
tr_count_eq_right(x, X::AbstractVector)
Count the number of elements to the right of and equal to x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_g_left
— Methodtr_count_g_left(i, x)
tr_count_g_left(x)
tr_count_g_left(x, X::AbstractVector)
Count the number of elements to the left of and greater than x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_g_param
— Methodtr_count_g_param(i, x; param)
tr_count_g_param(x; param)
tr_count_g_param(x, X::AbstractVector; param)
Count the number of elements greater than x[i] + param
. Extended method to vector with sig (x, param)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_g_right
— Methodtr_count_g_right(i, x)
tr_count_g_right(x)
tr_count_g_right(x, X::AbstractVector)
Count the number of elements to the right of and greater than x[i]
. Extended method to vector with sig (x)
are generated.
CompositionalNetworks.tr_count_greater
— Methodtr_count_greater(i, x)
tr_count_greater(x)
tr_count_greater(x, X::AbstractVector)
Count the number of elements greater than x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_l_left
— Methodtr_count_l_left(i, x)
tr_count_l_left(x)
tr_count_l_left(x, X::AbstractVector)
Count the number of elements to the left of and lesser than x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_l_param
— Methodtr_count_l_param(i, x; param)
tr_count_l_param(x; param)
tr_count_l_param(x, X::AbstractVector; param)
Count the number of elements lesser than x[i] + param
. Extended method to vector with sig (x, param)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_l_right
— Methodtr_count_l_right(i, x)
tr_count_l_right(x)
tr_count_l_right(x, X::AbstractVector)
Count the number of elements to the right of and lesser than x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_count_lesser
— Methodtr_count_lesser(i, x)
tr_count_lesser(x)
tr_count_lesser(x, X::AbstractVector)
Count the number of elements lesser than x[i]
. Extended method to vector with sig (x)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_identity
— Methodtr_identity(i, x)
tr_identity(x)
tr_identity(x, X::AbstractVector)
Identity function. Already defined in Julia as identity
, specialized for vectors. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_in_unrolled_expansion_##312
— Methodtr_in(tr, X, x, param)
Application of an operation from the transformation layer. Used to generate more efficient code for all compositions.
CompositionalNetworks.tr_param_minus_val
— Methodtr_param_minus_val(i, x; param)
tr_param_minus_val(x; param)
tr_param_minus_val(x, X::AbstractVector; param)
Return the difference param - x[i]
if positive, 0.0
otherwise. Extended method to vector with sig (x, param)
are generated. When X
is provided, the result is computed without allocations.
CompositionalNetworks.tr_val_minus_param
— Methodtr_val_minus_param(i, x; param)
tr_val_minus_param(x; param)
tr_val_minus_param(x, X::AbstractVector; param)
Return the difference x[i] - param
if positive, 0.0
otherwise. Extended method to vector with sig (x, param)
are generated. When X
is provided, the result is computed without allocations.