コード例 #1
0
  @Test
  public void canSetLayersOnAnUninitializedNetwork() {
    assertEquals(0, network.getLayers().size());

    Set<Layer> layers = new HashSet<Layer>();
    layers.add(new Layer());
    layers.add(new Layer());
    layers.add(new Layer());

    network.setLayers(layers);
    assertEquals(layers, network.getLayers());
  }
コード例 #2
0
  @Test
  public void initializedNetworkHasLayers() {
    List<Layer> layers = new ArrayList<Layer>();
    layers.add(new Layer());
    layers.add(new Layer());
    layers.add(new Layer());

    NeuralNetworkImpl network = new NeuralNetworkImpl(layers);
    assertEquals(layers, network.getLayers());
  }
コード例 #3
0
  @Test
  public void addLayersAddsLayersToNullLayerList() {
    network.setLayers(null);

    List<Layer> layers = new ArrayList<Layer>();
    layers.add(new Layer());
    layers.add(new Layer());

    network.addLayers(layers);
    assertEquals(2, network.getLayers().size());
  }
コード例 #4
0
  @Test
  public void addLayersWithANullListDoesntRemoveOldLayers() {
    List<Layer> layers = new ArrayList<Layer>();
    layers.add(new Layer());
    layers.add(new Layer());
    layers.add(new Layer());

    NeuralNetworkImpl network = new NeuralNetworkImpl(layers);

    network.addLayers(null);
    assertEquals(3, network.getLayers().size());
  }
コード例 #5
0
  @Test
  public void addLayersAddsUniqueLayers() {
    List<Layer> layers = new ArrayList<Layer>();
    layers.add(new Layer());
    layers.add(new Layer());
    layers.add(new Layer());

    NeuralNetworkImpl network = new NeuralNetworkImpl(layers);

    layers = new ArrayList<Layer>();
    layers.add(new Layer());
    layers.add(new Layer());

    network.addLayers(layers);
    assertEquals(5, network.getLayers().size());
  }
コード例 #6
0
  @Test
  public void addLayerDoesntAddExistingLayer() {
    List<Layer> layers = new ArrayList<Layer>();
    Layer oldLayer = new Layer();
    layers.add(oldLayer);
    layers.add(new Layer());
    layers.add(new Layer());

    NeuralNetworkImpl network = new NeuralNetworkImpl(layers);

    layers = new ArrayList<Layer>();
    layers.add(oldLayer);
    layers.add(new Layer());

    network.addLayers(layers);
    assertEquals(4, network.getLayers().size());
  }
コード例 #7
0
 @Test
 public void uninitializedNetworkHasEmptyLayers() {
   assertEquals(0, network.getLayers().size());
 }