本文整理汇总了Python中nolearn.lasagne.NeuralNet.get_fscore方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNet.get_fscore方法的具体用法?Python NeuralNet.get_fscore怎么用?Python NeuralNet.get_fscore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nolearn.lasagne.NeuralNet
的用法示例。
在下文中一共展示了NeuralNet.get_fscore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sorted
# 需要导入模块: from nolearn.lasagne import NeuralNet [as 别名]
# 或者: from nolearn.lasagne.NeuralNet import get_fscore [as 别名]
'eval_metric' : 'auc'
}
num_round = 100
kf = cross_validation.KFold(len(y), n_folds=4, random_state=33)
for train_index, test_index in kf:
X_train, X_test = X[train_index], X[test_index]
y_train, y_test = y[train_index], y[test_index]
dtrain = xgb.DMatrix(X_train, y_train)
dtest = xgb.DMatrix(X_test, y_test)
watchlist = [(dtest,'eval'), (dtrain,'train')]
clf = xgb.train(param, dtrain, num_round, watchlist)
# check importance
importance = clf.get_fscore()
tuples = [(k, importance[k]) for k in importance]
tuples = sorted(tuples, key=lambda x: x[1], reverse=True)
labels, values = zip(*tuples)
print values
for i in range(len(values)):
if values[i] == 1:
print labels[i],
print
break
#preds = clf.predict(dtest)