Exemple #1
0
def make_item_cnt_month():
    logger.info('MakeItemCntMonth starts')
    train = load_train_data()
    item_cnt_month = train['item_cnt_day'].groupby( \
     [train['date_block_num'], train['shop_id'], train['item_id']]).apply(sum)
    item_cnt_month.name = 'item_cnt_month'
    item_cnt_month_df = pd.DataFrame(item_cnt_month)
    logger.debug(item_cnt_month_df.shape)
    item_cnt_month.to_csv('./result_tmp/scaled_train.csv',
                          encoding='utf-8-sig')
    logger.debug('MakeItemCntMonth ends')
    return item_cnt_month
Exemple #2
0
def make_train_in_test():
	logger.info('train in test starts')
	train = load_train_data()
	test = load_test_data()
	logger.info('train.org.shape:{}'.format(train.shape))
	test_shops = test.shop_id.unique()
	test_items = test.item_id.unique()
	train = train[train.shop_id.isin(test_shops)]
	train = train[train.item_id.isin(test_items)]
	train['date'] = pd.to_datetime(train['date'], format='%d.%m.%Y')
	train['month'] = train['date'].dt.month  #TimeSeries。月のみの抽出。
	logger.info('train in test.shape:{}'.format(train.shape))
	logger.debug('train in test ends')
	return train, test
Exemple #3
0
def make_item_cnt_month():
    logger.info('MakeItemCntMonth starts')
    train = load_train_data()
    item_cnt_month = train['item_cnt_day'].groupby( \
     [train['date_block_num'], train['shop_id'], train['item_id']]).sum()
    item_cnt_month.name = 'item_cnt_month'
    item_cnt_month_df = pd.DataFrame(item_cnt_month)
    logger.debug(item_cnt_month_df.shape)
    logger.debug(train.shape)
    adjusted_train = pd.merge(train,
                              item_cnt_month_df,
                              on=['date_block_num', 'shop_id', 'item_id'])
    logger.debug(adjusted_train.shape)
    adjusted_train.to_csv('./result_tmp/adjusted_train', encoding='utf-8-sig')
    logger.debug('MakeItemCntMonth ends')
    return adjusted_train
            #############################################################################
            accuracy = sess.run(self.accuracy_op, feed_dict=feed_dict)
            eval_accuracy += accuracy
            eval_iter += 1
        return eval_accuracy / eval_iter
    
    
    
    
    
num_training = 49000
num_validation = 50000 - num_training
num_test = 10000

# Load cifar-10 data
X_train, Y_train, X_val, Y_val = load_train_data()
X_test, Y_test = load_test_data()


print X_train.shape

# Clear old computation graphs
tf.reset_default_graph()

sess = tf.Session()

model = imageModel()
model.train(sess, X_train, Y_train, X_val, Y_val)
accuracy = model.evaluate(sess, X_test, Y_test)
print('***** test accuracy: %.3f' % accuracy)