本文整理汇总了Python中dataset.Dataset.create_dataset方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.create_dataset方法的具体用法?Python Dataset.create_dataset怎么用?Python Dataset.create_dataset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.create_dataset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Vocabulary
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import create_dataset [as 别名]
vocab = Vocabulary('./word2vec.embeddings')
with tf.Session() as sess:
model = SlotTaggerModel(sess, vocab, Dataset.get_slots())
if args.mode == 'train':
train = []
dev = []
files = os.listdir(args.dir)
for file in files:
if file.endswith('.train'):
train += read_file(os.path.join(args.dir, file))
elif file.endswith('.dev'):
dev += read_file(os.path.join(args.dir, file))
train_dataset = Dataset.create_dataset(train)
dev_dataset = Dataset.create_dataset(dev)
print('Data size (train: %d, dev: %d)' % (train_dataset.length(), dev_dataset.length()))
total_time = time.time()
while True:
print('Training...')
start_time = time.time()
cost = model.train(sess, train_dataset)
accuracy, _ = model.test(sess, dev_dataset)
print('global step %d, accuracy %s, cost %s, duration: %s' % (
model.get_global_step(), accuracy, cost, round(time.time() - start_time, 2)))
sys.stdout.flush()
elif args.mode == 'test':
test = []
示例2: get_team_id_dict
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import create_dataset [as 别名]
from data_reader import get_team_id_dict, parse_all_stats
from dataset import Dataset
from feature_creator import create_game_keys, feat_score_diff
import sys
team_ids = get_team_id_dict(sys.argv[1])
gids = create_game_keys(sys.argv[2], team_ids)
raw_data = parse_all_stats(sys.argv[2], gids, team_ids)
dataset = Dataset()
dataset.create_dataset(sys.argv[3], team_ids, gids, raw_data)