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


Java Logs.debug方法代码示例

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


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

示例1: load_trusts

import happy.coding.io.Logs; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void load_trusts() throws Exception
{
	if (userTNsMap == null)
	{
		switch (Dataset.dataset)
		{
			case MOVIELENS:
			case JESTER:
			case NETFLIX:
				break;
			default:
				String trustSet = Dataset.DIRECTORY + Dataset.TRUST_SET;
				Logs.debug("Loading trust data ...");
				Map[] data = DatasetUtils.loadTrustSet2(trustSet);
				userTrusteesMap = data[0];
				userTrustorsMap = data[1];
				userTrustRatingsMap = data[2];
				Logs.debug("Done!");
				break;
		}

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

示例2: 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

示例3: center

import happy.coding.io.Logs; //导入方法依赖的package包/类
@Test
public void center()
{
	double[] prices = { 4, 4, 2, 2, 4, 3, 4, 4, 4, 4, 3, 3, 2, 5, 3, 4, 2, 5, 5, 4, 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4, 4, 1, 3, 5, 3, 2, 4, 3, 3, 1, 2,
			3, 4, 3, 4, 3, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 5, 4, 4, 3, 4, 4, 3, 2, 4, 5, 4, 4, 2, 4, 4, 4,
			4, 3, 2, 2, 5, 3, 4, 3, 3, 4, 4, 4, 3, 3, 3, 3, 2, 3, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 4, };

	double mean = Stats.mean(prices);
	double median = Stats.median(prices);
	double mode = Stats.mode(prices);

	Logs.debug("Mean = {}, Median = {}, Mode = {}", new Object[] { mean, median, mode });
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:24,代码来源:VirRatingsCF.java

示例4: saveModel

import happy.coding.io.Logs; //导入方法依赖的package包/类
protected String saveModel() throws Exception {
	// make a folder
	modelFolder = resultFolder + File.separator + "model/";
	FileIO.makeDirectory(modelFolder);

	if (!FileIO.exist(modelFolder + "config"))
		FileIO.copyFile(configPath, modelFolder + "config");

	// save the rating matrix and dao as binary to save space
	String suffix = ".bin";
	if (cf.isOn("save.model.bin")) {
		suffix = ".bin";
		FileIO.serialize(U, modelFolder + "userFactors" + suffix);
		FileIO.serialize(T, modelFolder + "textFactors" + suffix);
		if (V != null)
			FileIO.serialize(V, modelFolder + "visualFactors" + suffix);
	} else {
		suffix = ".txt";
		if (U != null)
			VectorUtil.saveMatrix(U, modelFolder + "userFactors" + suffix);
		if (T != null)
			VectorUtil.saveMatrix(T, modelFolder + "textFactors" + suffix);
		if (V != null)
			VectorUtil.saveMatrix(V, modelFolder + "visualFactors" + suffix);
	}

	suffix = ".txt";
	// save name-id maps
	VectorUtil.saveMap(trainDao.getIdUsers(), modelFolder + "idUsers" + suffix);
	VectorUtil.saveMap(trainDao.getIdItems(), modelFolder + "train_idItems" + suffix);
	VectorUtil.saveMap(testDao.getIdItems(), modelFolder + "test_idItems" + suffix);
	Logs.debug("Learned models are saved to folder \"{}\"", modelFolder);

	return modelFolder;
}
 
开发者ID:kite1988,项目名称:famf,代码行数:36,代码来源:Recommender.java

示例5: example_randInts

import happy.coding.io.Logs; //导入方法依赖的package包/类
@Test
public void example_randInts() throws Exception {
	for (int i = 0; i < 20; i++) {
		List<Integer> ints = Randoms.randInts(5, 0, 10);
		Logs.debug("Iteration " + (i + 1) + " : " + ints);
	}
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:8,代码来源:Randoms.java

示例6: pause

import happy.coding.io.Logs; //导入方法依赖的package包/类
public static void pause() {
	try {
		Logs.debug("System paused, press [enter] to continue ...");
		System.in.read();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:9,代码来源:Systems.java

示例7: load_tags

import happy.coding.io.Logs; //导入方法依赖的package包/类
private void load_tags() throws Exception
{
	String file = "movie-tags.csv";
	if (itemTags == null)
	{
		itemTags = new HashMap<>();
		String path = FileIO.makeDirPath(Dataset.DIRECTORY, file);

		Logs.debug("Load item's tags from {}", Strings.shortStr(path));

		tags = new ArrayList<>();

		BufferedReader br = new BufferedReader(new FileReader(new File(path)));
		String line = null;
		while ((line = br.readLine()) != null)
		{
			String[] data = line.split(",");
			String item = data[0];
			String tag = data[1]; //.toLowerCase().replace(" ", "");

			if (!tags.contains(tag)) tags.add(tag);

			Map<String, Integer> innerMap = null;
			if (itemTags.containsKey(item)) innerMap = itemTags.get(item);
			else innerMap = new HashMap<>();

			int count = 0;
			if (innerMap.containsKey(tag)) count = innerMap.get(tag);
			count++;

			innerMap.put(tag, count);
			itemTags.put(item, innerMap);
		}
		br.close();
	}
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:37,代码来源:CBF_mt.java

示例8: read_url

import happy.coding.io.Logs; //导入方法依赖的package包/类
/**
 * read the contents of a specific {@code url} every {@code sleep} millionseconds
 * @return html contents
 */
protected String read_url(String url) throws Exception
{
	if(use_proxy) return read_url_w_proxy(url);
	
	Thread.sleep(sleep);

	int max_trails = 200;
	int count = 0;
	while (true)
	{
		count++;

		try
		{
			String html = URLReader.read(url);

			// judge if page is completely or just partially read
			if (html.contains("<html") && !html.contains("</html>")) continue;
			else return html;
		} catch (IOException ce)
		{
			if (count > max_trails) return null;
			Logs.debug("Try again [times: " + count + "]: " + ce.getMessage());
		}
	}
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:31,代码来源:WebCrawler.java

示例9: e_log

import happy.coding.io.Logs; //导入方法依赖的package包/类
@Test
public void e_log() {
	Logs.debug("ln(2) = " + ln(2));
	Logs.debug("ln(e) = " + ln(Math.E));
	Logs.debug("log(2) = " + Math.log(2));
	Logs.debug("log(e) = " + Math.log(Math.E));
	Logs.debug("log10(100) = " + Math.log10(100));
}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:9,代码来源:Maths.java

示例10: prepTestRatings

import happy.coding.io.Logs; //导入方法依赖的package包/类
@Override
protected void prepTestRatings()
{
	Logs.debug("Preparing test-rating data ...");
	if (testRatings == null)
	{
		// only physical ratings needs to be tested.
		testRatings = new ArrayList<>();

		for (Entry<String, Map<String, Rating>> entry : userRatingsMap.entrySet())
		{
			String user = entry.getKey();

			Map<String, Rating> val = entry.getValue();
			if (Integer.parseInt(user) <= PhyRatingUpbound && val.size() > 0)
			{
				switch (params.DATASET_MODE)
				{
					case all:
						testRatings.addAll(val.values());
						break;
					case coldUsers:
						if (val.size() < 5) testRatings.addAll(val.values());
						break;
					default:
						break;
				}

			}
		}

	}
	Logs.debug("Done!");
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:35,代码来源:VirRatingsCF.java

示例11: run_ratings

import happy.coding.io.Logs; //导入方法依赖的package包/类
public void run_ratings(String url) throws Exception
{
	String html = read_url(url);
	Document doc = Jsoup.parse(html);
	String name = doc.select("span[property=v:itemreviewed]").text();
	name = Strings.filterWebString(name, '_');

	String dirPath = dir + name + "/ratings/";
	FileIO.makeDirectory(dirPath);

	// save rating pages
	int k = 0;
	while (true)
	{
		String link = url + "collections?start=" + (k * 20);
		String page = read_url(link);

		k++;
		FileIO.writeString(dirPath + "page_" + k + ".html", page);
		Logs.debug("Current processing page: " + k);

		// if finished;
		Document doc2 = Jsoup.parse(page);
		Elements es = doc2.select("div#collections_tab span.next");
		if (es == null || es.size() == 0)
		{
			break;
		}
	}

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

示例12: captureScreen

import happy.coding.io.Logs; //导入方法依赖的package包/类
public static void captureScreen(String fileName) throws Exception {

		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Rectangle screenRectangle = new Rectangle(screenSize);
		Robot robot = new Robot();
		BufferedImage image = robot.createScreenCapture(screenRectangle);

		File file = new File(fileName);
		ImageIO.write(image, "png", file);

		Logs.debug("A screenshot is captured to: {}", file.getPath());
	}
 
开发者ID:guoguibing,项目名称:HappyCoding,代码行数:13,代码来源:Systems.java

示例13: formatTestRatings

import happy.coding.io.Logs; //导入方法依赖的package包/类
private void formatTestRatings()
{
	Logs.debug("Format test ratings ...");

	/* format test ratings */
	testUserRatingsMap = new HashMap<>();
	testItemRatingsMap = new HashMap<>();

	for (Rating r : testRatings)
	{
		String user = r.getUserId();
		String item = r.getItemId();

		Map<String, Rating> irs = null;
		Map<String, Rating> urs = null;

		if (testUserRatingsMap.containsKey(user)) irs = testUserRatingsMap.get(user);
		else irs = new HashMap<>();

		if (testItemRatingsMap.containsKey(item)) urs = testItemRatingsMap.get(item);
		else urs = new HashMap<>();

		irs.put(item, r);
		urs.put(user, r);

		testUserRatingsMap.put(user, irs);
		testItemRatingsMap.put(item, urs);
	}

	Logs.debug("# test users = {}, items = {}, ratings = {}", new Object[] { testUserRatingsMap.size(),
			testItemRatingsMap.size(), testRatings.size() });
	Logs.debug("Done!");
}
 
开发者ID:466152112,项目名称:HappyResearch,代码行数:34,代码来源:AbstractCF.java

示例14: readRatingDataTrain

import happy.coding.io.Logs; //导入方法依赖的package包/类
/**
 * Read rating data from the data file.
 * 
 * Each line is: user_id item_id 1, user_id item_id 0, user_id item_id 0, ...
 */
public void readRatingDataTrain(String path) throws Exception {
	System.out.println("Loading rating from " + path);

	BufferedReader br = FileUtil.createReader(path);
	String line = null;
	while ((line = br.readLine()) != null) {
		String[] tuples = line.trim().split(",");

		boolean first = true;
		int posUser = -1, posItem = -1;
		for (String data : tuples) {
			String[] tuple = data.trim().split(" ");
			String user = tuple[0].trim();
			String item = tuple[1].trim();
			Float rate = Float.valueOf(tuple[2].trim());
			if (rate == 0) {
				rate = -1.0f;
			}

			// inner id starting from 0
			int row = userIds.containsKey(user) ? userIds.get(user) : userIds.size();
			int col = itemIds.containsKey(item) ? itemIds.get(item) : itemIds.size();

			userIds.put(user, row);
			itemIds.put(item, col);

			if (first) {
				posUser = row;
				posItem = col;
				first = false;
			} else {
				RatingTuple t = new RatingTuple(posUser, posItem, col);
				ratingTuple.add(t);
			}
			numRates++;
		}
	}
	br.close();

	int numRows = numUsers(), numCols = numItems();
	Logs.debug("Dataset: {Users, {}} = {{}, {}, {}}", ("Items, Ratings"), numRows, numCols, numRates);
}
 
开发者ID:kite1988,项目名称:famf,代码行数:48,代码来源:DataDAO.java

示例15: readRatingDataTest

import happy.coding.io.Logs; //导入方法依赖的package包/类
/**
 * Read data from the data file. Note that we didn't take care of the
 * duplicated lines.
 * 
 * Each line is: user_id item_id publisher_id 1, user_id item_id
 * publisher_id 0, ...
 */
public void readRatingDataTest(String path) throws Exception {
	System.out.println("Loading rating from " + path);
	// Table {row-id, col-id, rate}
	Table<Integer, Integer, Float> dataTable = HashBasedTable.create();

	// Map {col-id, multiple row-id}: used to fast build rate matrix
	Multimap<Integer, Integer> colMap = HashMultimap.create();

	BufferedReader br = FileUtil.createReader(path);
	String line = null;
	while ((line = br.readLine()) != null) {
		String[] tuples = line.trim().split(",");

		for (String data : tuples) {
			String[] tuple = data.trim().split(" ");
			String user = tuple[0].trim();
			String item = tuple[1].trim();
			Float rate = Float.valueOf(tuple[2].trim());
			if (rate == 0) {
				rate = -1.0f;
			}

			int row = getId(userIds, user);
			int col = itemIds.containsKey(item) ? itemIds.get(item) : itemIds.size();

			itemIds.put(item, col);
			dataTable.put(row, col, rate);
			colMap.put(col, row);
		}
	}
	br.close();

	numRates = dataTable.size();
	int numRows = numUsers(), numCols = numItems();

	Logs.debug("Dataset: {Users, {}} = {{}, {}, {}, {}}", ("Items, Ratings"), numRows, numCols, numRates);

	// build rating matrix
	ratingMatrix = new SparseMatrix(numRows, numCols, dataTable, colMap);
	dataTable = null;
}
 
开发者ID:kite1988,项目名称:famf,代码行数:49,代码来源:DataDAO.java


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