Ticket #226: bayes-cont-bug.py

File bayes-cont-bug.py, 786 bytes (added by anonymous, 6 years ago)
Line 
1import orange
2data = orange.ExampleTable("iris.tab")
3
4bayes = orange.BayesLearner()
5bayes.estimatorConstructor = orange.ProbabilityEstimatorConstructor_relative()
6bayes.conditionalEstimatorConstructor = orange.ConditionalProbabilityEstimatorConstructor_ByRows(estimatorConstructor=orange.ProbabilityEstimatorConstructor_relative())
7bayes.conditionalEstimatorConstructorContinuous = orange.ConditionalProbabilityEstimatorConstructor_loess(
8                   windowProportion = 0.2, nPoints = 100)
9
10indices = orange.MakeRandomIndicesCV(data, 2, randseed=0, stratified = 1)
11trainset = data.select(ind, 1)
12testset = data.select(ind, 0)
13results = orngTest.learnAndTestOnTestData(learners, trainset, testset)
14
15model = bayes(trainset)
16print model(testset[51], orange.GetBoth)