當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。