Exemplo n.º 1
0
def test_CloneLayer():
    node = mdp.nodes.PCANode(input_dim=10, output_dim=5)
    x = numx_rand.random([10, 70]).astype('f')
    layer = mh.CloneLayer(node, 7)
    layer.train(x)
    y = layer.execute(x)
    assert layer.dtype == numx.dtype('f')
    assert y.dtype == layer.dtype
Exemplo n.º 2
0
def test_SFA_net(noisenode):
    sfa_node = mdp.nodes.SFANode(input_dim=20 * 20, output_dim=10, dtype='f')
    switchboard = mh.Rectangular2dSwitchboard(in_channels_xy=100,
                                              field_channels_xy=20,
                                              field_spacing_xy=10)
    flownode = mh.FlowNode(mdp.Flow([noisenode, sfa_node]))
    sfa_layer = mh.CloneLayer(flownode, switchboard.output_channels)
    flow = mdp.Flow([switchboard, sfa_layer])
    train_gen = numx.cast['f'](numx_rand.random((3, 10, 100 * 100)))
    flow.train([None, train_gen])
Exemplo n.º 3
0
def testHiNetHTML(noisenode):
    # create some flow for testing
    sfa_node = mdp.nodes.SFANode(input_dim=20 * 20, output_dim=10)
    switchboard = mh.Rectangular2dSwitchboard(in_channels_xy=100,
                                              field_channels_xy=20,
                                              field_spacing_xy=10)
    flownode = mh.FlowNode(mdp.Flow([noisenode, sfa_node]))
    sfa_layer = mh.CloneLayer(flownode, switchboard.output_channels)
    flow = mdp.Flow([switchboard, sfa_layer])
    # create dummy file to write the HTML representation
    html_file = io.StringIO()
    hinet_html = mdp.hinet.HiNetHTMLVisitor(html_file)
    hinet_html.convert_flow(flow)
    html_file.close()
Exemplo n.º 4
0
def test_hinet_simple_net():
    switchboard = mh.Rectangular2dSwitchboard(in_channels_xy=(12, 8),
                                              field_channels_xy=4,
                                              field_spacing_xy=2,
                                              in_channel_dim=3)

    node = mdp.nodes.PCANode(input_dim=4 * 4 * 3, output_dim=5)
    flownode = mh.FlowNode(mdp.Flow([
        node,
    ]))
    layer = mh.CloneLayer(flownode, switchboard.output_channels)
    flow = mdp.Flow([switchboard, layer])
    x = numx_rand.random([5, switchboard.input_dim])
    flow.train(x)