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


Java Logs.info方法代码示例

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


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

示例1: listen

import happy.coding.io.Logs; //导入方法依赖的package包/类
public void listen() throws Exception
{
	while (true)
	{
		if (ss == null) return;
		Socket conn = ss.accept();
		Logs.debug("Get Connection from " + conn.getRemoteSocketAddress());

		InputStream is = conn.getInputStream();
		StringBuilder sb = new StringBuilder();
		int ch;

		while ((ch = is.read()) != -1)
			sb.append((char) ch);
		
		Logs.info("Message from Client: {}", sb.toString());

		is.close();
		conn.close();
	}
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:22,代码来源:SocketServer.java

示例2: printEvalInfo

import happy.coding.io.Logs; //导入方法依赖的package包/类
/**
 * print out the evaluation information for a specific algorithm
 */
private static void printEvalInfo(Recommender algo, Map<Measure, Double> ms) {

	String result = Recommender.getEvalInfo(ms);
	String time = Dates.parse(ms.get(Measure.TrainTime).longValue()) + ","
			+ Dates.parse(ms.get(Measure.TestTime).longValue());
	String evalInfo = String.format("%s,%s,%s,%s", algo.algoName, result, algo.toString(), time);

	Logs.info(evalInfo);
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:13,代码来源:LibRec.java

示例3: statistics

import happy.coding.io.Logs; //导入方法依赖的package包/类
/**
 * Compute the statistics of the CiaoDVDs dataset
 * 
 * @param dirPath
 *            the directory path of the dataset
 * @throws Exception
 */
@Test
public void statistics() throws Exception {
	// movie ratings: {user, movie, rating}
	Table<String, String, Integer> ratings = loadRatingSet(ratingSet);

	Multiset<Integer> scales = HashMultiset.create();
	scales.addAll(ratings.values());
	Logs.info("Movie rating scales:");
	Logs.info(scales.toString());
	Logs.info("Users: {}, movies: {}, ratings: {}\n", new Object[] {
			ratings.rowKeySet().size(), ratings.columnKeySet().size(),
			ratings.size() });

	// review ratings: {user, review, rating}
	Table<String, String, Integer> reviews = loadReviewSet(reviewSet);
	scales.clear();
	scales.addAll(reviews.values());
	Logs.info("Movie review scales:");
	Logs.info(scales.toString());
	Logs.info("Users: {}, reviews: {}, ratings: {}\n", new Object[] {
			reviews.rowKeySet().size(), reviews.columnKeySet().size(),
			reviews.size() });

	// trust ratings: {trustor, trustee, rating}
	Table<String, String, Integer> trusts = loadTrustSet(trustSet);
	Logs.info("Trustors: {}, trustees: {}, trusts: {}\n",
			new Object[] { trusts.rowKeySet().size(),
					trusts.columnKeySet().size(), trusts.size() });

	Set<String> users = new HashSet<>();
	users.addAll(ratings.rowKeySet());
	users.addAll(reviews.rowKeySet());
	users.addAll(trusts.rowKeySet());
	users.addAll(trusts.columnKeySet());
	Logs.info("Overall users: {}", users.size());

}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:45,代码来源:CiaoDataset.java

示例4: crawl_data

import happy.coding.io.Logs; //导入方法依赖的package包/类
public static void crawl_data() throws Exception
{
	String filePath = FileIO.getResource("gewara.txt");

	List<String> urls = FileIO.readAsList(filePath);
	String[] tasks = { "comments" };

	int nd = 4;
	for (String task : tasks)
	{
		Logs.info("Current task: " + task);
		for (int i = 0; i < urls.size(); i += nd)
		{
			Thread[] tds = new Thread[nd];

			boolean flag = false;
			for (int j = 0; j < nd; j++)
			{
				if (i + j >= urls.size())
				{
					flag = true;
					break;
				}

				String url = urls.get(i + j).trim();
				tds[j] = new Thread(new GewaraCrawler(url, task, i + j + 1));
				tds[j].start();
			}

			for (Thread td : tds)
			{
				if (td != null) td.join();
			}

			if (flag) break;
		}
	}
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:39,代码来源:GewaraCrawler.java

示例5: crawl_data

import happy.coding.io.Logs; //导入方法依赖的package包/类
public static void crawl_data() throws Exception
{
	String filePath = FileIO.getResource("douban.txt");

	List<String> urls = FileIO.readAsList(filePath);
	String[] tasks = { "reviews" };

	int nd = 4;
	for (String task : tasks)
	{
		Logs.info("Current task: " + task);
		for (int i = 0; i < urls.size(); i += nd)
		{
			Thread[] tds = new Thread[nd];

			boolean flag = false;
			for (int j = 0; j < nd; j++)
			{
				if (i + j >= urls.size())
				{
					flag = true;
					break;
				}

				String url = urls.get(i + j).trim();
				tds[j] = new Thread(new DoubanCrawler(url, task, i + j + 1));
				tds[j].start();
			}

			for (Thread td : tds)
			{
				if (td != null) td.join();
			}

			if (flag) break;
		}
	}
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:39,代码来源:DoubanCrawler.java

示例6: printSpecs

import happy.coding.io.Logs; //导入方法依赖的package包/类
public void printSpecs() {
	Logs.info("Starts at {}", Dates.now());
	Logs.info(null);

	String suffix = Strings.repeat('-', 22);
	Logs.info(suffix + " Global Setting " + suffix);
	Logs.info("Currently data set   = {} ({})", Dataset.LABEL, Dataset.DIRECTORY);
	Logs.info("Validation approach  = {}", VALIDATE_METHOD.name());
	Logs.info("Prediction method    = {}", PREDICT_METHOD.name());
	Logs.info("Calculate similarity = {}", params.SIMILARITY_METHOD);

	Logs.info(null);
	Logs.info(suffix + " Method Results " + suffix);
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:15,代码来源:ConfigParams.java

示例7: printPerformance

import happy.coding.io.Logs; //导入方法依赖的package包/类
@Override
protected void printPerformance(Performance pf)
{
	// super.printPerformance(pf);
	Logs.info("------------------ {} ------------------", pf.getMethod(), params.DATASET_MODE);

	if (printSettings.size() > 0)
	{
		for (String setting : printSettings)
			Logs.info(setting);
		Logs.info(null);

		printSettings.clear();
	}

	Measures ms = pf.prediction(testUserRatingsMap);
	Logs.info("MAE = {}, MACE = {}", (float) ms.getMAE(), (float) ms.getMACE());

	Logs.info(null);
	Logs.info("" + (float) ms.getMAE());
	Logs.info("" + (float) ms.getMACE());
	Logs.info("" + (float) ms.getRC() * 100 + "%");
	Logs.info(null);

	if (virEnabled)
	{
		Measures ms2 = pf2.prediction(testUserRatingsMap);
		Logs.info("Predictable MAE = {}, MACE = {}", (float) ms.getMAE(), (float) ms.getMACE());

		Logs.info(null);
		Logs.info("" + (float) ms2.getMAE());
		Logs.info("" + (float) ms2.getMACE());
	}
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:35,代码来源:VirRatingsCF.java

示例8: write

import happy.coding.io.Logs; //导入方法依赖的package包/类
public void write(String content) throws Exception
{
	socket = new Socket(remoteHost, remotePort);
	
	OutputStream os = socket.getOutputStream();
	
	content += "\r\n";
	os.write(content.getBytes());
	os.flush();
	Logs.info("Output to Server: {}", content);
	
	os.close();
	socket.close();
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:15,代码来源:SocketClient.java

示例9: evaluate

import happy.coding.io.Logs; //导入方法依赖的package包/类
/**
 * Evalute the performance of our ETAF model
 */
protected void evaluate(String path) throws Exception {

	Map<String, Float> preds = null;
	Map<String, Integer> trustees = null;
	int topN = 20;
	Set<String> trustors = trusts.rowKeySet();

	List<Float> precs5 = new ArrayList<>();
	List<Float> precs10 = new ArrayList<>();
	List<Float> recalls5 = new ArrayList<>();
	List<Float> recalls10 = new ArrayList<>();
	List<Float> aps = new ArrayList<>();
	List<Float> rrs = new ArrayList<>();
	List<Float> aucs = new ArrayList<>();
	List<Float> ndcgs = new ArrayList<>();

	for (String u : trustors) {
		// load preds
		String dataFile = path + u + ".txt";
		if (!FileIO.exist(dataFile))
			continue;
		preds = loadPreds(dataFile);
		// ground truth
		trustees = trusts.row(u);

		List<KeyValPair<String>> sorted = Lists.sortMap(preds, true);
		List<KeyValPair<String>> recomd = sorted.subList(0, sorted.size() > topN ? topN : sorted.size());

		List<String> rankedList = new ArrayList<>();
		for (KeyValPair<String> kv : recomd)
			rankedList.add(kv.getKey());

		List<String> groundTruth = new ArrayList<>(trustees.keySet());
		int num_dropped_items = 0;
		double AUC = Measures.AUC(rankedList, groundTruth, num_dropped_items);
		double AP = Measures.AP(rankedList, groundTruth);
		double nDCG = Measures.nDCG(rankedList, groundTruth);
		double RR = Measures.RR(rankedList, groundTruth);

		List<Integer> ns = Arrays.asList(5, 10);

		Map<Integer, Double> precs = Measures.PrecAt(rankedList, groundTruth, ns);
		Map<Integer, Double> recalls = Measures.RecallAt(rankedList, groundTruth, ns);

		precs5.add(precs.get(5).floatValue());
		precs10.add(precs.get(10).floatValue());
		recalls5.add(recalls.get(5).floatValue());
		recalls10.add(recalls.get(10).floatValue());

		aucs.add((float) AUC);
		aps.add((float) AP);
		rrs.add((float) RR);
		ndcgs.add((float) nDCG);
	}

	float prec5 = (float) Stats.mean(precs5);
	float prec10 = (float) Stats.mean(precs10);
	float recall5 = (float) Stats.mean(recalls5);
	float recall10 = (float) Stats.mean(recalls10);
	float ndcg = (float) Stats.mean(ndcgs);
	// float auc = (float) Stats.mean(aucs);
	float map = (float) Stats.mean(aps);
	float mrr = (float) Stats.mean(rrs);

	Logs.info("{},{},{},{},{},{},{},{},{}", new Object[] { model, prec5, prec10, recall5, recall10, map, ndcg, mrr,
			settings });

}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:72,代码来源:TrustModel.java

示例10: crawl_data

import happy.coding.io.Logs; //导入方法依赖的package包/类
public static void crawl_data() throws Exception {
	if (Debug.OFF) {
		// home page
		CiaoCrawler cc = new CiaoCrawler();
		cc.run_home_page();
		return;
	}

	String sourceFile = "users.txt"; // "dvd.ciao.txt"
	String filePath = FileIO.getResource(sourceFile);
	List<String> urls = FileIO.readAsList(filePath);

	String[] tasks = { "users" };

	int nd = 8;
	for (String task : tasks) {
		Logs.info("Current task: " + task);
		for (int i = 0; i < urls.size(); i += nd) {
			Thread[] tds = new Thread[nd];

			boolean flag = false;
			for (int j = 0; j < nd; j++) {
				if (i + j >= urls.size()) {
					flag = true;
					break;
				}

				String url = urls.get(i + j).trim();
				tds[j] = new Thread(new CiaoCrawler(url, task, i + j + 1));
				tds[j].start();
			}

			for (Thread td : tds) {
				if (td != null)
					td.join();
			}

			if (flag)
				break;
		}
	}
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:43,代码来源:CiaoCrawler.java

示例11: SocketServer

import happy.coding.io.Logs; //导入方法依赖的package包/类
public SocketServer(int port) throws Exception
{
	ss = new ServerSocket(port);
	Logs.info("Server Listen to Port: {}", port);
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:6,代码来源:SocketServer.java


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