本文整理汇总了Python中Preprocessor.Preprocessor.generateSubmission方法的典型用法代码示例。如果您正苦于以下问题:Python Preprocessor.generateSubmission方法的具体用法?Python Preprocessor.generateSubmission怎么用?Python Preprocessor.generateSubmission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preprocessor.Preprocessor
的用法示例。
在下文中一共展示了Preprocessor.generateSubmission方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runModel
# 需要导入模块: from Preprocessor import Preprocessor [as 别名]
# 或者: from Preprocessor.Preprocessor import generateSubmission [as 别名]
def runModel(self, testSize, debug):
self.trainVectorizer()
d = self.getXy('train.tsv')
if debug:
X_train, X_test, y_train, y_test = train_test_split(d['X'], d['y'], test_size=testSize, random_state=5)
else:
X_train = d['X']
y_train = d['y']
d_test = self.getXy('test.tsv')
X_test = d_test['X']
urlid = d_test['urlid']
self.fit(X_train, y_train)
print "20 Fold CV Score: ", np.mean(cross_val_score(self.model, d['X'], d['y'], cv=10, scoring='roc_auc'))
y_predicted = self.predict(X_test)
if debug:
print 'Topic Model AUC Score: %f' % roc_auc_score(y_test, y_predicted)
else:
Pre = Preprocessor()
Pre.generateSubmission('submission_12.csv', urlid, y_predicted)
P.figure()
P.hist(y_predicted, bins=100)
P.show()