Skip to content

Instantly share code, notes, and snippets.

View HappyStorm's full-sized avatar
🌀

HaleyWu HappyStorm

🌀
View GitHub Profile
@HappyStorm
HappyStorm / generator.py
Created April 17, 2017 18:23
Self-defined generator
# definition of generator
def generator_from_ndarray(x, y, batch_size=32):
number_of_batches = np.ceil(x.shape[0]/batch_size).astype(int)
while True:
for i in range(number_of_batches):
yield x[i*batch_size:(i+1)*batch_size], y[i*batch_size:(i+1)*batch_size]
# x_train.shape = (5000, 100, 600, 1)
package org.apache.hadoop.examples;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;