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


Java LinearClassifierFactory.setVerbose方法代码示例

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


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

示例1: trainRVF

import edu.stanford.nlp.classify.LinearClassifierFactory; //导入方法依赖的package包/类
public LinearClassifier trainRVF(List<HashMap<String, Double>> list_feature2values,
		List<String> list_labels) {
	List<Datum<String, String>> trainingData = new ArrayList<Datum<String, String>>();
	for (int i = 0; i < list_feature2values.size(); i++) {
		HashMap<String, Double> feature2values = list_feature2values.get(i);
		String label = list_labels.get(i);
		Datum<String, String> d = new RVFDatum(Counters.fromMap(feature2values), label);
		trainingData.add(d);
	}
	// Build a classifier factory
	LinearClassifierFactory<String, String> factory = new LinearClassifierFactory<String, String>();
	factory.setSigma(3);
	factory.setEpsilon(15);
	factory.useQuasiNewton();
	factory.setVerbose(true);
	LinearClassifier<String, String> classifier = factory.trainClassifier(trainingData);
	// {
	// ArrayList<String> temp = new ArrayList<String>();
	// temp.add("NS=" + GREEN);
	// System.out.println(classifier.scoreOf(new BasicDatum<String,
	// String>(temp, BROKEN), BROKEN));
	// }

	this.classifier = classifier;
	return classifier;
}
 
开发者ID:zhangcongle,项目名称:NewsSpikeRe,代码行数:27,代码来源:StanfordRegression.java

示例2: trainBasic

import edu.stanford.nlp.classify.LinearClassifierFactory; //导入方法依赖的package包/类
public LinearClassifier trainBasic(
		List<List<String>> list_features, List<String> list_labels) {
	List<Datum<String, String>> trainingData = new ArrayList<Datum<String, String>>();
	for (int i = 0; i < list_features.size(); i++) {
		List<String> features = list_features.get(i);
		String label = list_labels.get(i);
		Datum<String, String> d = new BasicDatum<String, String>(features, label);
		trainingData.add(d);
	}
	// Build a classifier factory
	LinearClassifierFactory<String, String> factory = new LinearClassifierFactory<String, String>();
	// factory.setTol(tol);
	// factory.setSigma(1);
	// factory.setEpsilon(0.01);
	// factory.useQuasiNewton();
	factory.setVerbose(true);
	LinearClassifier<String, String> classifier = factory.trainClassifier(trainingData);
	// {
	// ArrayList<String> temp = new ArrayList<String>();
	// temp.add("NS=" + GREEN);
	// System.out.println(classifier.scoreOf(new BasicDatum<String,
	// String>(temp, BROKEN), BROKEN));
	// }

	this.classifier = classifier;
	return classifier;
}
 
开发者ID:zhangcongle,项目名称:NewsSpikeRe,代码行数:28,代码来源:StanfordRegression.java


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