Пример #1
0
        private static TrainingSet CreateTrainingSetFromResources(IEnumerable <KeyValuePair <User, double[]> > studentsAndMarks)
        {
            var resultTrainingSet = new TrainingSet(studentsAndMarks.First().Value.Length);

            foreach (var studentAndMark in studentsAndMarks)
            {
                resultTrainingSet.AddRecord(studentAndMark.Value);
            }

            return(resultTrainingSet);
        }
Пример #2
0
        public void TrainingSetAdd()
        {
            var set = new TrainingSet(3);

            set.AddRecord(new[] { 3.0, 4.0, 5.0 });
            set.AddRecord(new[] { 3.0, 4.0, 5.0 });
            set.AddRecord(new[] { 3.0, 4.0, 5.0 });

            Assert.AreEqual(set.GetCountOfRecords(), 3);

            try
            {
                set.AddRecord(new[] { 3.0, 4.0, 5.0, 6.0 });
            }
            catch (Exception)
            {
                Assert.Pass();
                return;
            }

            Assert.Fail();
        }