Struct ducky_learn::layers::Dense1d
source · pub struct Dense1d { /* private fields */ }Implementations§
source§impl Dense1d
impl Dense1d
sourcepub fn from(
activation: fn(_: Array1<f64>) -> Array1<f64>,
weights: Array2<f64>,
bias: Array1<f64>
) -> Self
pub fn from(
activation: fn(_: Array1<f64>) -> Array1<f64>,
weights: Array2<f64>,
bias: Array1<f64>
) -> Self
Create Dense1d layer with full control over every part of the layer
Arguments
activation: Activation function of whole 1d arrayweights: 2d array that has to be of shape( output, input )bias: 1d array of basis that has to be the size of the output
returns: Dense1d
Examples
use ducky_learn::layers::*;
use ndarray::{arr1, arr2};
let layer = Dense1d::from(
|x| x, // Activation function that is does nothing
arr2(&[[1., 1.], [1., 1.]]), // 2x2 array
arr1(&[1., 1.]) // len 2
);