AIMA.Core.Learning.Learners.CurrentBestLearner.train C# (CSharp) Метод

train() публичный Метод

public train ( DataSet ds ) : void
ds AIMA.Core.Learning.Framework.DataSet
Результат void
        public void train(DataSet ds) {
		folDSDomain = new FOLDataSetDomain(ds.specification, trueGoalValue);
		List<FOLExample> folExamples = new List<FOLExample>();
		int egNo = 1;
		foreach (Example e in ds.examples) {
			folExamples.Add(new FOLExample(folDSDomain, e, egNo));
			egNo++;
		}

		// Setup a KB to be used for learning
		kb = new FOLKnowledgeBase(folDSDomain, new FOLOTTERLikeTheoremProver(
				1000, false));

		CurrentBestLearning cbl = new CurrentBestLearning(folDSDomain, kb);

		currentBestHypothesis = cbl.currentBestLearning(folExamples);
	}

Usage Example

Пример #1
0
        public void testCurrentBestLearnerOnRestaurantDataSet()
        {
            DataSet ds = DataSetFactory.getRestaurantDataSet();
            CurrentBestLearner learner = new CurrentBestLearner("Yes");
            learner.train(ds);

            int[] result = learner.test(ds);
            Assert.AreEqual(12, result[0]);
            Assert.AreEqual(0, result[1]);
        }