本文整理汇总了Python中store.Store.len_of_numeric方法的典型用法代码示例。如果您正苦于以下问题:Python Store.len_of_numeric方法的具体用法?Python Store.len_of_numeric怎么用?Python Store.len_of_numeric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类store.Store
的用法示例。
在下文中一共展示了Store.len_of_numeric方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dict
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import len_of_numeric [as 别名]
with codecs.open('./data/map.tsv', 'r', 'utf-8') as f:
lines = f.readlines()
features_list = lines[0].rstrip().split('\t')[1::]
types = lines[1].rstrip().split('\t')[1::]
features_dict = dict(zip(features_list, types))
for feature in features_list:
if features_dict[feature] == 'categorical':
store.categorical_features[feature] = set()
else:
store.numeric_features.append(feature)
store.len_of_numeric = len(store.numeric_features)
store.len_of_categorical = len(store.categorical_features)
for line in lines[2::]:
store.words.append(Word())
columns = line.rstrip().split('\t')
store.words[-1].name = columns[0]
for feature, value in zip(features_list, columns[1::]):
if features_dict[feature] == 'int':
store.words[-1].features[feature] = int(value)
elif features_dict[feature] == 'float':
store.words[-1].features[feature] = float(value)
else:
store.words[-1].features[feature] = value