From 2ae48bd768186a1b35e6f4c896a42f0cebe4765c Mon Sep 17 00:00:00 2001 From: Size43 Date: Tue, 19 May 2015 14:18:28 +0200 Subject: commented things --- .../main/java/org/rssin/neurons/FeedSorter.java | 114 +++++++++++---------- 1 file changed, 58 insertions(+), 56 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/org/rssin/neurons/FeedSorter.java b/app/src/main/java/org/rssin/neurons/FeedSorter.java index fee6f4d..43e26c0 100755 --- a/app/src/main/java/org/rssin/neurons/FeedSorter.java +++ b/app/src/main/java/org/rssin/neurons/FeedSorter.java @@ -1,6 +1,8 @@ package org.rssin.neurons; +import java.io.IOException; import java.util.Calendar; +import java.util.Hashtable; import java.util.TimeZone; /** @@ -12,9 +14,9 @@ public class FeedSorter { private int[] isNthMonthInput = new int[12]; private int[] isNthWeekDayInput = new int[7]; private int isMorning, isAfternoon, isEvening, isNight; - private Hashtable categoryInputs = new Hashtable(); - private Hashtable wordInputs = new Hashtable(); - private Hashtable feedSourceInputs = new Hashtable(); + private Hashtable categoryInputs = new Hashtable(); + private Hashtable wordInputs = new Hashtable(); + private Hashtable feedSourceInputs = new Hashtable(); public FeedSorter() { //TODO: Load Neural Network @@ -38,58 +40,58 @@ public class FeedSorter { isNight = nn.addInput(); } - private PredictionInterface getPrediction(FeedItem item) { - double[] inputs = new double[nn.getInputCount()]; +// private PredictionInterface getPrediction(FeedItem item) { +// double[] inputs = new double[nn.getInputCount()]; +// +// //Initialize all inputs to -1 / false +// for(int i = 0; i < inputs.length; i++) +// { +// inputs[i] = -1; +// } +// +// //Set month +// Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); +// for(int i = 0; i < isNthMonthInput.length; i++) +// { +// if(cal.get(Calendar.MONTH) - cal.getMinimum(Calendar.MONTH) == i) +// { +// inputs[isNthMonthInput[i]] = 1; +// } +// } +// +// //Set weekday +// for(int i = 0; i < isNthWeekDayInput.length; i++) +// { +// if(cal.get(Calendar.DAY_OF_WEEK) - cal.getMinimum(Calendar.DAY_OF_WEEK) == i) +// { +// inputs[isNthMonthInput[i]] = 1; +// } +// } +// +// //Set day +// int hourOfDay = cal.get(Calendar.HOUR_OF_DAY); +// if(hourOfDay > 6 && hourOfDay < 12) +// { +// inputs[isMorning] = 1; +// }else if(hourOfDay >= 12 && hourOfDay <= 6) +// { +// inputs[isAfternoon] = 1; +// }else if(hourOfDay >= 6 && hourOfDay < 23) +// { +// inputs[isEvening] = 1; +// }else if(hourOfDay >= 23 || hourOfDay <= 6) +// { +// inputs[isNight] = 1; +// } +// +// //TODO: source, category, title, text, etc of FeedItems +// +// return nn.computeOutput(inputs); +// } - //Initialize all inputs to -1 / false - for(int i = 0; i < inputs.length; i++) - { - inputs[i] = -1; - } - - //Set month - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); - for(int i = 0; i < isNthMonthInput.length; i++) - { - if(cal.get(Calendar.MONTH) - cal.getMinimum(Calendar.MONTH) == i) - { - inputs[isNthMonthInput[i]] = 1; - } - } - - //Set weekday - for(int i = 0; i < isNthWeekDayInput.length; i++) - { - if(cal.get(Calendar.DAY_OF_WEEK) - cal.getMinimum(Calendar.DAY_OF_WEEK) == i) - { - inputs[isNthMonthInput[i]] = 1; - } - } - - //Set day - int hourOfDay = cal.get(Calendar.HOUR_OF_DAY); - if(hourOfDay > 6 && hourOfDay < 12) - { - inputs[isMorning] = 1; - }else if(hourOfDay >= 12 && hourOfDay <= 6) - { - inputs[isAfternoon] = 1; - }else if(hourOfDay >= 6 && hourOfDay < 23) - { - inputs[isEvening] = 1; - }else if(hourOfDay >= 23 || hourOfDay <= 6) - { - inputs[isNight] = 1; - } - - //TODO: source, category, title, text, etc of FeedItems - - return nn.computeOutput(inputs); - } - - public List sortItems(List items) { - // Sort list based on something like date + nn.computeOutput() * DAY. - throw new NotImplementedException(); - return items; - } +// public List sortItems(List items) { +// // Sort list based on something like date + nn.computeOutput() * DAY. +// throw new NotImplementedException(); +// return items; +// } } -- cgit v1.2.3