-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNeural_layer.m
30 lines (25 loc) · 1003 Bytes
/
Neural_layer.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
classdef Neural_layer
%NEURAL_LAYER Class that represent a layer of a neural network.
% attr: n_input_connections, activation_function, n_neurons, bias, w (weights).
properties
n_input_connections
activation_function
n_neurons
bias
W
end
methods
function obj = Neural_layer(n_input_connections,n_neurons,activation_function)
%NEURAL_LAYER Construct an instance of this class
% the weights are initialized randomly with values between -1 and 1.
obj.n_input_connections = n_input_connections;
obj.n_neurons = n_neurons;
obj.activation_function = activation_function;
obj.bias = ones(1,n_neurons) ;
obj.W = rand(n_input_connections, n_neurons) *2 -1; % entre -1 y 1
end
function obj = reset_bias(obj)
obj.bias = ones(1,obj.n_neurons) ;
end
end
end