Exemple #1
0
        void TestLifeModel(int F, int V, int n = 5, bool future = false)
        {
            /*
             *
             * '''--------------------------------------Reading sample from thesis
             * F, V= (3,5)
             #C, G, B= (0, 1, 2)
             #VL, L, N, H, VH= (0, 1, 2, 3, 4)
             * Z=[TemporalAbstraction(1,3,1,5),#(G,H,1,4)
             * TemporalAbstraction(0,2,2,14),#(C,N,2,14)
             * TemporalAbstraction(2,2,4,20),#(B,N,4,20)
             * TemporalAbstraction(1,2,6,9),#(G,N,6,9)
             * TemporalAbstraction(1,3,10,13),#(G,H,10,13)
             * TemporalAbstraction(0,3,15,24),#(C,H,15,24)
             * TemporalAbstraction(1,4,16,23)#(G,VH,16,23)
             * ]
             * '''
             *
             * */
            F = 2;
            V = 2;
            // int C=0, G=1,
            List <TemporalAbstraction> MSS = new List <TemporalAbstraction>();

            for (int i = 0; i < 50; i++)
            {
                MSS.Add(new TemporalAbstraction(i % 2, 1 - i % 2, i, i + 2));
            }
            //Z =[TemporalAbstraction(i % 2, (1 - i % 2), i, i + 2) for i in range(50)]



            LifeModel lm  = new LifeModel(F, V, n, future);
            var       ITS = lm.GetITS(MSS);
        }
Exemple #2
0
        public List <List <Point> > MapMultivariateTimeSeries(List <Point> mts, TimeSpan delta, bool fixedIntervals = false)
        {
            var result = new List <List <Point> >();

            var periods = LifeModel.CreatePeriods(32, fixedSize: fixedIntervals, DeltaT: delta.TotalSeconds);//32 seconds by default


            //Normalize values to zero (Maximum is zero, everything else is negative)
            var max = mts.Max(x => x.TimeStamp);

            //mts.ForEach(x => );
            mts = mts.Select(x => x.Normalize(max)).ToList();

            //And it is about history



            //foreach (var point in mts)
            {
                for (int i = 0; i < periods.Count; i++)
                {
                    List <Point> intervalPoints = new List <Point>();
                    if (!fixedIntervals)//Life Model->Millisecond periods
                    {
                        intervalPoints = mts.Where(x =>
                                                   ((x.TimeStamp.TotalMilliseconds >= periods[i].start) && (x.TimeStamp.TotalMilliseconds < periods[i].end))).ToList();//.ToDictionary(x => x.Key, x => x.Value);//.ToDictionary (.ToDictionary<int,TemporalAbstraction>( ;//.Select(x=>x.Value).ToList();
                    }
                    else//Fixed intervals are second in fractions
                    {
                        intervalPoints = mts.Where(x =>
                                                   ((x.TimeStamp.TotalSeconds >= periods[i].start) && (x.TimeStamp.TotalSeconds < periods[i].end))).ToList();//.ToDictionary(x => x.Key, x => x.Value);//.ToDictionary (.ToDictionary<int,TemporalAbstraction>( ;//.Select(x=>x.Value).ToList();
                    }
                    result.Add(intervalPoints);

                    //Binary search later!! or direct finding!
                    //if(point.TimeStamp.)
                }
            }


            //find each point s locatio in each period and add it to thaf list


            //Give each mappmapped List of points to a mapper function
            // Mapped should contain the MIM mapped interval matrix. and the result is mapped interval sequrnce MIS
            return(result);
        }