Linear

Linear layer accepting sparse or dense parents and outputing a dense vector.

Constructors

this
this()
Undocumented in source.
this
this(ulong dim_out, bool with_intercept_)
Undocumented in source.

Members

Functions

_accumulate_grad_row
void _accumulate_grad_row(float[] row, float g, ulong index)
Undocumented in source. Be warned that the author may not have intended to support it.
accumulate_grad
void accumulate_grad(float[] ext_grad)
Undocumented in source. Be warned that the author may not have intended to support it.
accumulate_grad
void accumulate_grad(SparseF[] ext_grad)
Undocumented in source. Be warned that the author may not have intended to support it.
allocate_grad_params
void allocate_grad_params()
Undocumented in source. Be warned that the author may not have intended to support it.
allocate_params
void allocate_params()
Undocumented in source. Be warned that the author may not have intended to support it.
deserialize
void deserialize(Serializer s)
Undocumented in source. Be warned that the author may not have intended to support it.
dup
NeuralLayer dup()
Undocumented in source. Be warned that the author may not have intended to support it.
init
void init(double rand_scale)
Undocumented in source. Be warned that the author may not have intended to support it.
predict
void predict()
Undocumented in source. Be warned that the author may not have intended to support it.
prior
Linear prior(ProxyLinearPrior prior)
Undocumented in source. Be warned that the author may not have intended to support it.
prior
Linear prior(AdditiveLinearPrior prior)
Undocumented in source. Be warned that the author may not have intended to support it.
serialize
void serialize(Serializer s)
Undocumented in source. Be warned that the author may not have intended to support it.
share_params
void share_params(NeuralLayer l)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin opCallNew
Undocumented in source.

Properties

num_params
ulong num_params [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
with_intercept
bool with_intercept [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

W
float[][] W;
Undocumented in source.
_with_intercept
size_t _with_intercept;
Undocumented in source.
grad
float[][] grad;
Undocumented in source.
priors
AdditiveLinearPrior[] priors;
Undocumented in source.
prox
ProxyLinearPrior prox;
Undocumented in source.

Mixed In Members

From mixin opCallNew

opCall
auto opCall(T args)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From NeuralLayer

name
string name;
type
LayerT type;
dim_in
size_t dim_in;

total input dimension of this layer (sum of output dimensions of its parents)

dim_out
size_t dim_out;

total output dimension of this layer

children
NeuralLayer[] children;

array referencing all the children of this layer

parents
NeuralLayer[] parents;

array referencing all the parents of this layer

_learnable
bool _learnable;
Undocumented in source.
learnable
bool learnable [@property getter]

whether or not this layer has any parameters to be learnt

out_d
float[] out_d;

dense output vector of this layer (might be unused)

out_s
SparseF[] out_s;

sparse output vector of this layer (might be unused)

backgrads
float[][] backgrads;

array of gradients to backpropagate to parents

init
void init(double random_scale)
Undocumented in source. Be warned that the author may not have intended to support it.
predict
void predict()
Undocumented in source.
accumulate_grad
void accumulate_grad(float[] grad)
Undocumented in source. Be warned that the author may not have intended to support it.
accumulate_grad
void accumulate_grad(SparseF[] grad)
Undocumented in source. Be warned that the author may not have intended to support it.
num_params
ulong num_params [@property getter]
Undocumented in source.
dup
NeuralLayer dup()
Undocumented in source. Be warned that the author may not have intended to support it.
allocate_interface
void allocate_interface()
Undocumented in source. Be warned that the author may not have intended to support it.
allocate_params
void allocate_params()
Undocumented in source. Be warned that the author may not have intended to support it.
allocate_grad_params
void allocate_grad_params()
Undocumented in source. Be warned that the author may not have intended to support it.
optimizer
Optimizer optimizer;
Undocumented in source.
optimizer_set
optimizer_set [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
set_type
void set_type(LayerT t)
Undocumented in source. Be warned that the author may not have intended to support it.
forward_prop
void forward_prop()
Undocumented in source. Be warned that the author may not have intended to support it.
backward_prop
void backward_prop(V[] grad)
Undocumented in source. Be warned that the author may not have intended to support it.
set_optimizer
void set_optimizer(Optimizer opt_)
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset()
Undocumented in source. Be warned that the author may not have intended to support it.
set_name
void set_name(string name_)
Undocumented in source. Be warned that the author may not have intended to support it.
ser
void ser(Serializer s)
Undocumented in source. Be warned that the author may not have intended to support it.
deser
void deser(Serializer s)
Undocumented in source. Be warned that the author may not have intended to support it.
serialize
void serialize(Serializer s)
Undocumented in source. Be warned that the author may not have intended to support it.
deserialize
void deserialize(Serializer s)
Undocumented in source. Be warned that the author may not have intended to support it.
pre_learning
void pre_learning()
Undocumented in source. Be warned that the author may not have intended to support it.
post_learning
void post_learning()
Undocumented in source. Be warned that the author may not have intended to support it.
share_params
void share_params(NeuralLayer layer)
Undocumented in source. Be warned that the author may not have intended to support it.
recompute_topology
void recompute_topology()
Undocumented in source. Be warned that the author may not have intended to support it.
not_learnable_branch
bool not_learnable_branch(NeuralLayer layer)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

auto l1 = Linear(10); // 10 dense output neurons, each with an intercept
auto l2 = Linear(5, false); // 5 dense output neurons, without intercepts

Meta