本文整理汇总了Python中classifier.Classifier.preds方法的典型用法代码示例。如果您正苦于以下问题:Python Classifier.preds方法的具体用法?Python Classifier.preds怎么用?Python Classifier.preds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类classifier.Classifier
的用法示例。
在下文中一共展示了Classifier.preds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import preds [as 别名]
data, targets = Data.data()
print "training data: ", len(data)
test = Data.test()
print "test data: ", len(test)
data = data + test
print "all data: ", len(data)
# preprocessing
start = time()
matrix = BlackboxPreprocess.to_matrix(data)
print matrix.shape
matrix = BlackboxPreprocess.scale(matrix)
#matrix = BlackboxPreprocess.polynomial(matrix, 2)
matrix = preprocessing.normalize(matrix, norm='l2')
min_max_scaler = preprocessing.MinMaxScaler(feature_range=(-1.,1.))
matrix = min_max_scaler.fit_transform(matrix)
#matrix = BlackboxPreprocess.norm(matrix)
print matrix.shape
data = matrix.tolist()
# split training and test data
test_data = data[1000:]
data, targets = data[:1000], targets[:1000]
# testing
preds = Classifier.preds(data, targets, test_data, [])
print "Duration: ", time() - start
submission(preds)
示例2: time
# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import preds [as 别名]
#data = data + psuedo_data
#targets = targets + psuedo_targets
# preprocessing
start = time()
print len(data)
print len(data[-1])
matrix = BlackboxPreprocess.to_matrix(data)
print "(examples, dimensions): ", matrix.shape
matrix = BlackboxPreprocess.scale(matrix)
matrix = BlackboxPreprocess.polynomial(matrix, 2)
#matrix = preprocessing.normalize(matrix, norm='l2')
#min_max_scaler = preprocessing.MinMaxScaler(feature_range=(0.,1.))
#matrix = min_max_scaler.fit_transform(matrix)
#matrix = BlackboxPreprocess.norm(matrix)
print "(examples, dimensions): ", matrix.shape
data = matrix.tolist()
# split training and CV data
cv_data, cv_targets = data[:500], targets[:500]
#data, targets = data[500:], targets[500:] # include extra data
data, targets = data[500:1000], targets[500:1000] # don't include extra data
extra = data
# testing
preds = Classifier.preds(data, targets, cv_data, cv_targets, extra)
s = score(preds, cv_targets, debug=False)
print "Score: ", s
log(s)
print "Duration: ", time() - start