Beispiel #1
0
def create_output_neuron(activation_function,
                         bias,
                         initial_bias_connection_weight=0.0):
    neuron = Neuron(np.array([]),
                    list(),
                    activation_function,
                    cache_weighted_input=True)
    Connection(bias, neuron, initial_bias_connection_weight)
    return neuron
def create_neuron(activation_function=None, bias=None):
    """Creates neuron with defined activation function and bias."""
    # If activation function not defined, choose activation function at random.
    if not activation_function:
        activation_function = choice(list(_ACTIVATION_FUNCTIONS.keys()))
    neuron = Neuron(array([]), list(), activation_function)
    # If is biased, connect to bias with random weight.
    if bias:
        Connection(bias, neuron, uniform(-1, 1))
    return neuron
def create_output_neuron(activation_function, bias, initial_bias_connection_weight=0.0):
    neuron = Neuron(array([]), list(), activation_function)
    Connection(bias, neuron, initial_bias_connection_weight)
    return neuron