[−][src]Struct neuro::models::Network
Structure representing a neural network.
Methods
impl Network
[src]
pub fn new<L: 'static + Loss, O: 'static + Optimizer>(
input_shape: Dim,
loss_function: L,
optimizer: O,
regularizer: Option<Regularizer>
) -> Result<Network, Error>
[src]
input_shape: Dim,
loss_function: L,
optimizer: O,
regularizer: Option<Regularizer>
) -> Result<Network, Error>
Creates an empty neural network.
The input shape must be in the form [height, width, channel, 1]. Mini-batches are created along the fourth dimension.
pub fn add(&mut self, layer: Box<dyn Layer>)
[src]
Adds a layer to the network.
pub fn fit<T: DataSet>(
&mut self,
data: &T,
batch_size: u64,
epochs: u64,
print_loss: Option<u64>,
metrics: Option<Vec<Metrics>>
)
[src]
&mut self,
data: &T,
batch_size: u64,
epochs: u64,
print_loss: Option<u64>,
metrics: Option<Vec<Metrics>>
)
Fits the neural network with the training data.
The training data are shuffled at the beginning of each epoch, before batches are created. The progress is printed
at every print_loss
epoch.
pub fn evaluate<T: DataSet>(&self, data: &T, metrics: Option<Vec<Metrics>>)
[src]
Evaluates the model on the test set.
Arguments
data
- The dataset containing the test data.metrics
- A vector containing the metrics that will be evaluated.
pub fn predict(&self, input: &Tensor) -> Tensor
[src]
Computes the output of the network for the given input.
Multiple samples can be evaluated at once by stacking them along the fourth dimension of the tensor.
Return value
Tensor of the predicted output
pub fn predict_class(&self, input: &Tensor) -> Vec<(String, PrimitiveType)>
[src]
Predicts the class for the input.
Multiple samples can be evaluated at once by stacking them along the fourth dimension of the tensor.
Return value
Vector of tuples containing the predicted class and the probability for each sample.
Panic
Panics if the model doesn't contain a classes dictionary.
pub fn save(&self, filename: &str) -> Result<(), Error>
[src]
Saves the model in HDF5 format.
pub fn load(filename: &str) -> Result<Network, Error>
[src]
Loads a model from a HDF5 file.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Network
impl !Send for Network
impl !Sync for Network
impl Unpin for Network
impl !UnwindSafe for Network
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,