示例#1
0
        public static void FilterInstances(weka.core.Instances allInstances)
        {
            DateTime nextHpDate = DateTime.MinValue;

            java.util.LinkedList deleteList = new java.util.LinkedList();
            for (int i = 0; i < allInstances.numInstances(); ++i)
            {
                DateTime nowDate = WekaUtils.GetDateValueFromInstances(allInstances, 0, i);

                if (TestParameters2.RealTimeMode && i == allInstances.numInstances() - 1)
                {
                    allInstances.instance(i).setClassValue(0);
                    allInstances.instance(i).setValue(1, WekaUtils.GetTimeFromDate(Parameters.MaxDate) * 1000);
                }
                else
                {
                    if (nowDate < nextHpDate)
                    {
                        deleteList.Add(allInstances.instance(i));
                    }
                    else
                    {
                        DateTime hpDate = WekaUtils.GetDateValueFromInstances(allInstances, 1, i);
                        nextHpDate = hpDate;
                    }
                }
            }
            allInstances.removeAll(deleteList);
        }