Model class

The Model class represents a neural network model, composed of a list of layers. This class is fundamental for defining the structure of a neural network, where each layer contains neurons that are connected to form the network. Make sure to connect all layers with edges before building the model.

Constructors

Model({required List<Layer> layers})

Properties

hashCode int
The hash code for this object.
no setterinherited
layers List<Layer>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Future<String>
The toJson() method serializes the model's layers and their contents into a JSON format. Each layer's type, number of neurons, neuron names, values, and edge weights are included in the JSON string, which is returned when the operation is complete.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromJson({required String jsonString}) Future<Model>
The fromJson() method takes a JSON string as input and reconstructs the model. It reads the JSON data, creates the input, hidden, and output layers, and establishes the connections (edges) between neurons. It returns the fully constructed model if successful; otherwise, it throws an exception.