当前位置: 首页>>代码示例>>Python>>正文


Python Classifier.ensemble_preds方法代码示例

本文整理汇总了Python中classifier.Classifier.ensemble_preds方法的典型用法代码示例。如果您正苦于以下问题:Python Classifier.ensemble_preds方法的具体用法?Python Classifier.ensemble_preds怎么用?Python Classifier.ensemble_preds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在classifier.Classifier的用法示例。


在下文中一共展示了Classifier.ensemble_preds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: len

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import ensemble_preds [as 别名]
from image import Image
from preprocess import Preprocess
from classifier import Classifier
from log_loss import log_loss
from postprocess import PostProcess

genders = Image.genders()
d, _ = Image.data()
matrix = Preprocess.to_matrix(d)
print matrix.shape
matrix = Preprocess.remove_constants(matrix)
print matrix.shape
matrix = Preprocess.scale(matrix)
matrix = Preprocess.polynomial(matrix, 2)
matrix = Preprocess.scale(matrix)
print matrix.shape
matrix = matrix.tolist()
half = len(matrix)/2
train, cv = matrix[:half], matrix[half:]
train_genders, cv_genders = genders[:half], genders[half:]
cv_genders = cv_genders[0::4]
preds = Classifier.ensemble_preds(train, train_genders, cv)
print "Score: ", log_loss(preds, cv_genders)
开发者ID:pmiller10,项目名称:handwriting_classification,代码行数:25,代码来源:runner.py

示例2: len

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import ensemble_preds [as 别名]
from image import Image
from preprocess import Preprocess
from classifier import Classifier
from postprocess import PostProcess

genders = Image.genders()
all_data, ids = Image.all()
matrix = Preprocess.to_matrix(all_data)
matrix = Preprocess.remove_constants(matrix)
matrix = Preprocess.scale(matrix)
matrix = Preprocess.polynomial(matrix, 2)
matrix = Preprocess.scale(matrix)
matrix = matrix.tolist()
train = matrix[:1128]
test = matrix[1128:]
test_ids = ids[1128:]
print len(train)
print len(test)
print len(test_ids)
print len(ids)
print len(matrix)
preds = Classifier.ensemble_preds(train, genders, test)  # real
# preds = Classifier.ensemble_preds(train, genders, train) # fake

# for creating submission file
PostProcess.submission(test_ids, preds)
开发者ID:pmiller10,项目名称:handwriting_classification,代码行数:28,代码来源:submitter.py


注:本文中的classifier.Classifier.ensemble_preds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。