protected MainViewModel()
 {
     Points = new ObservableCollection <DataItem>()
     {
         DataItem.Create(new DateTime(2015, 02, 18), 3.47, "A"),
         DataItem.Create(new DateTime(2015, 01, 01), 2.08, "B"),
         DataItem.Create(new DateTime(2015, 02, 01), 2.42, "C"),
         DataItem.Create(new DateTime(2015, 03, 01), 2.78, "E"),
         DataItem.Create(new DateTime(2015, 04, 01), 2.78, "F"),
         DataItem.Create(new DateTime(2015, 05, 01), 2.57, "G"),
         DataItem.Create(new DateTime(2015, 06, 01), 2.69, "H"),
         DataItem.Create(new DateTime(2015, 07, 01), 2.96, "I"),
         DataItem.Create(new DateTime(2015, 08, 01), 2.36, "J"),
         DataItem.Create(new DateTime(2015, 09, 01), 1.97, "K"),
         DataItem.Create(new DateTime(2015, 10, 11), 2.75, "L"),
         DataItem.Create(new DateTime(2015, 11, 12), 3.45, "M"),
         DataItem.Create(new DateTime(2015, 12, 13), 4.08, "N"),
         DataItem.Create(new DateTime(2014, 01, 14), 3.47, "P"),
         DataItem.Create(new DateTime(2014, 02, 15), 2.64, "Q"),
         DataItem.Create(new DateTime(2014, 03, 16), 4.59, "R"),
         DataItem.Create(new DateTime(2014, 04, 17), 1.54, "S"),
         DataItem.Create(new DateTime(2014, 05, 18), 4.12, "T"),
         DataItem.Create(new DateTime(2014, 06, 19), 3.47, "U"),
     };
 }
Ejemplo n.º 2
0
        private static IEnumerable <DataItem> GetDataset()
        {
            var items         = new List <DataItem>();
            var random        = new Random();
            var valuePartSize = INPUT_SIZE / OUTPUT_SIZE;

            for (int classIndex = 0; classIndex < OUTPUT_SIZE; classIndex++)
            {
                for (int i = 0; i < DATA_ITEMS_PER_CLASS; i++)
                {
                    var item       = DataItem.Create(INPUT_SIZE, OUTPUT_SIZE);
                    var startIndex = classIndex * valuePartSize;
                    for (int j = 0; j < valuePartSize; j++)
                    {
                        item.Input[startIndex + j] = 1;
                    }
                    for (int j = 0; j < INPUT_SIZE; j++)
                    {
                        if (random.NextDouble() <= NOISE_PROBABILITY)
                        {
                            item.Input[j] = random.NextDouble();
                        }
                    }
                    item.Output[classIndex] = 1;
                    items.Add(item);
                }
            }
            items = items.OrderBy(x => random.Next()).ToList();
            return(items);
        }
Ejemplo n.º 3
0
        public void AddSubItemWithNewerStartPointTest()
        {
            ProjectData project = new ProjectData(0);
            DateTime    now     = DateTime.Today;

            project.Data.Add(DataItem.Create(1, now, now.AddMinutes(5)));

            project.Data.Add(DataItem.Create(2, now.AddMinutes(30), null, DataItem.Create(3, now.AddMinutes(40), now.AddMinutes(45))));

            Assert.AreEqual(now.AddMinutes(30), project.Data[1].StartPoint);
            Assert.AreEqual(now.AddMinutes(45), project.Data[1].EndPoint);

            Assert.AreEqual(now, project.StartPoint);
            Assert.AreEqual(now.AddMinutes(45), project.EndPoint);

            project.Data.Add(DataItem.Create(1, now.AddMinutes(65)));

            Assert.AreEqual(now.AddMinutes(65), project.EndPoint);

            var subItem = DataItem.Create(3, now.AddMinutes(70));

            project.Data[1].Children.Add(subItem);

            Assert.AreEqual(now.AddMinutes(70), project.Data[1].EndPoint);
            Assert.AreEqual(now.AddMinutes(70), project.EndPoint);

            subItem.EndPoint = now.AddMinutes(75);

            Assert.AreEqual(now.AddMinutes(75), project.Data[1].EndPoint);
            Assert.AreEqual(now.AddMinutes(75), project.EndPoint);
        }
Ejemplo n.º 4
0
        public void NotifyTestWithIncludedSubItems()
        {
            ProjectData project = new ProjectData(0);
            DateTime    now     = DateTime.Today;

            project.Data.Add(new DataItem(1, now, now.AddMinutes(5)));
            project.Data.Add(DataItem.Create(2, now.AddMinutes(30), now.AddMinutes(55), DataItem.Create(3, now.AddMinutes(40), now.AddMinutes(45))));

            Assert.AreEqual(now.AddMinutes(30), project.Data[1].StartPoint);
            Assert.AreEqual(now.AddMinutes(55), project.Data[1].EndPoint);

            Assert.AreEqual(now, project.StartPoint);
            Assert.AreEqual(now.AddMinutes(55), project.EndPoint);
        }
Ejemplo n.º 5
0
        public void AddItemWithNewerStartPointTest()
        {
            ProjectData project = new ProjectData(0);
            DateTime    now     = DateTime.Today;

            project.Data.Add(new DataItem(1, now, now.AddMinutes(5)));
            project.Data.Add(DataItem.Create(2, now.AddMinutes(30), now.AddMinutes(55), DataItem.Create(3, now.AddMinutes(40), now.AddMinutes(45))));

            Assert.AreEqual(now.AddMinutes(30), project.Data[1].StartPoint);
            Assert.AreEqual(now.AddMinutes(55), project.Data[1].EndPoint);

            Assert.AreEqual(now, project.StartPoint);
            Assert.AreEqual(now.AddMinutes(55), project.EndPoint);

            project.Data.Add(DataItem.Create(1, now.AddMinutes(65)));

            Assert.AreEqual(now.AddMinutes(65), project.EndPoint);
        }
Ejemplo n.º 6
0
    static void Main()
    {
        var items = new List <DataItem>();

        items.Add(DataItem.Create(12345));
        items.Add(DataItem.Create(DateTime.Today));
        items.Add(DataItem.Create("abcde"));
        items.Add(DataItem.Create(new Foo {
            Bar = "Marc"
        }));
        items.Add(DataItem.Create(67890));

        // serialize and deserialize
        var clone = Serializer.DeepClone(items);

        foreach (DataItem item in clone)
        {
            Console.WriteLine(item.Value);
        }
    }