fromMap static method

ANN fromMap(
  1. Map<String, dynamic> m, {
  2. int? seed,
  3. int? epochs,
  4. double? lr,
})

Reconstruct an ANN from a previously-serialized Map.

Implementation

static ANN fromMap(
  Map<String, dynamic> m, {
  int? seed,
  int? epochs,
  double? lr,
}) {
  final layers = List<int>.from(m['layers'] as List);
  final model = ANN(
    layers: layers,
    epochs: epochs ?? 100,
    lr: lr ?? 0.01,
    seed: seed,
  );
  final rawW = m['weights'] as List;
  model.weights =
      rawW
          .map(
            (layer) =>
                (layer as List)
                    .map((row) => List<double>.from(row as List))
                    .toList(),
          )
          .toList();
  final rawB = m['biases'] as List;
  model.biases = rawB.map((b) => List<double>.from(b as List)).toList();
  model._inited = true;
  return model;
}