コード例 #1
0
ファイル: image_gen.py プロジェクト: Khepu/ihu
def generate_images():
    data = dataset()
    shops = get_shops(data)
    items = get_items(data)

    applied_image_item = map(lambda x: partial(image_item, x), shops)
    mapnp(lambda f: pmap(f, items), applied_image_item)
コード例 #2
0
ファイル: image_gen.py プロジェクト: Khepu/ihu
def image_item(shop, item):
    item_sales = partition(calendar_map(item, shop_sales(shop)))
    train, test = mapnp(annotate_year, item_sales)

    applied_img = partial(img, shop, item)
    mapnp(lambda t: applied_img("train", t[1], t[0]), train)
    mapnp(lambda t: applied_img("test", t[1], t[0]), test)
コード例 #3
0
ファイル: image_gen.py プロジェクト: Khepu/ihu
def partition(sales_list):
    """
    Splits the item sales into annual sales + November sales
    """

    sales_nparr = mapnp(np.array, sales_list).astype(np.uint8)
    train = mapnp(lambda i: sales_nparr[12 * i: 12 * i + 11], range(3))
    test = mapnp(lambda i: [sales_nparr[12 * i + 11],], range(3))

    return [train, test]
コード例 #4
0
ファイル: image_gen.py プロジェクト: Khepu/ihu
def calendar_map(item, shop_data):
    item_results = []
    for year in (2013, 2014, 2015):
        for month in (12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11):
            monthly_sales = mapnp(lambda d: date_loopup(item, shop_data, d, month, year), range(1, 32))
            item_results = enqueue(item_results, monthly_sales)
    return item_results
コード例 #5
0
ファイル: image_gen.py プロジェクト: Khepu/ihu
def annotate_year(col):
    return mapnp(arrayl, zip(col, (2013, 2014, 2015)))
コード例 #6
0
def split_date(date):
    return mapnp(int, date.split("."))