예제 #1
0
def training_stream(training_frame_files):
    split_streams = create_split_streams(training_frame_files)
    split_streams = [data_io.buffered_random(s) for s in split_streams]
    split_streams = [data_io.chop(s) for s in split_streams]
    stream = data_io.random_select_stream(*split_streams)
    stream = data_io.buffered_random(stream)
    return stream
예제 #2
0
def training_stream(training_frame_files):
    split_streams = create_split_streams(training_frame_files)
    split_streams = [ data_io.buffered_random(s) for s in split_streams ]
    split_streams = [ data_io.chop(s) for s in split_streams ]
    stream = data_io.random_select_stream(*split_streams)
    stream = data_io.buffered_random(stream)
    return stream
예제 #3
0
 def stream():
     stream = data_io.random_select_stream(*[
         data_io.stream_file('data/train.%02d.pklgz' % i)
         for i in xrange(1, 20)
     ])
     stream = data_io.buffered_sort(stream, key=lambda x: x[1].shape[0], buffer_items=128)
     batched_stream = reader.batch_and_pad(stream, batch_size=16, mean=mean, std=std)
     batched_stream = data_io.buffered_random(batched_stream, buffer_items=4)
     return batched_stream
예제 #4
0
 def stream():
     stream = data_io.random_select_stream(*[
         data_io.stream_file('data/train.%02d.pklgz' % i)
         for i in xrange(1, 20)
     ])
     stream = data_io.buffered_sort(stream,
                                    key=lambda x: x[1].shape[0],
                                    buffer_items=128)
     batched_stream = reader.batch_and_pad(stream,
                                           batch_size=16,
                                           mean=mean,
                                           std=std)
     batched_stream = data_io.buffered_random(batched_stream,
                                              buffer_items=4)
     return batched_stream
예제 #5
0
    P_learn = Parameters()
    updates = updates.adam(parameters,gradients,learning_rate=0.00025,P=P_learn)
    updates = normalise_weights(updates)

    print "Compiling..."
    train = theano.function(
            inputs=[X,l],
            outputs=batch_cost,
            updates=updates,
        )
    test = theano.function(inputs=[X,l],outputs=batch_cost)


    print "Calculating mean variance..."
    rand_stream = data_io.random_select_stream(*[
        data_io.stream_file('data/train.%02d.pklgz' % i)
        for i in xrange(1, 20)
    ])

    mean, std, count = reader.get_normalise(rand_stream)
    print "Dataset count:", count

    def stream():
        stream = data_io.random_select_stream(*[
            data_io.stream_file('data/train.%02d.pklgz' % i)
            for i in xrange(1, 20)
        ])
        stream = data_io.buffered_sort(stream, key=lambda x: x[1].shape[0], buffer_items=128)
        batched_stream = reader.batch_and_pad(stream, batch_size=16, mean=mean, std=std)
        batched_stream = data_io.buffered_random(batched_stream, buffer_items=4)
        return batched_stream
예제 #6
0
                           gradients,
                           learning_rate=0.00025,
                           P=P_learn)
    updates = normalise_weights(updates)

    print "Compiling..."
    train = theano.function(
        inputs=[X, l],
        outputs=batch_cost,
        updates=updates,
    )
    test = theano.function(inputs=[X, l], outputs=batch_cost)

    print "Calculating mean variance..."
    rand_stream = data_io.random_select_stream(*[
        data_io.stream_file('data/train.%02d.pklgz' % i)
        for i in xrange(1, 20)
    ])

    mean, std, count = reader.get_normalise(rand_stream)
    print "Dataset count:", count

    def stream():
        stream = data_io.random_select_stream(*[
            data_io.stream_file('data/train.%02d.pklgz' % i)
            for i in xrange(1, 20)
        ])
        stream = data_io.buffered_sort(stream,
                                       key=lambda x: x[1].shape[0],
                                       buffer_items=128)
        batched_stream = reader.batch_and_pad(stream,
                                              batch_size=16,