Problem with structure learning

The engine.
Post Reply
mch
Posts: 3
Joined: Wed Jan 16, 2019 5:26 pm

Problem with structure learning

Post by mch »

Hello
I'm using SMILE.NET wrapper (Academic version). I have problem with structure bayesian network learning using Naive Bayes algorithm (if I'm using Greedy Thick Thinning algorithm it happens too). When I try to learn my network - .NET throws SmileException with error code -1.

I import my dataset to database from CSV file. I attached example of dataset in attachment (it contains variables names in header too but I think it does not matter in this case). Star(*) values are replaced for -1 at runtime and it symbolizes missing value.

Using the opportunity I'd like to draw attention to the fact that Bayesian Search algorithm is missing in .NET wrapper - only NB and Greedy Think Thinning is available. Should it be like that?

I'd be grateful for your quick response. Thanks in advance.
example_data.csv
(3.03 KiB) Downloaded 384 times
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with structure learning

Post by shooltz[BayesFusion] »

I have problem with structure bayesian network learning using Naive Bayes algorithm. When I try to learn my network - .NET throws SmileException with error code -1.
How did you select the class variable?
Using the opportunity I'd like to draw attention to the fact that Bayesian Search algorithm is missing in .NET wrapper - only NB and Greedy Think Thinning is available. Should it be like that?
SMILE.NET will support Bayesian Search in version 1.3. We plan to release it within 4 to 6 weeks.
mch
Posts: 3
Joined: Wed Jan 16, 2019 5:26 pm

Re: Problem with structure learning

Post by mch »

shooltz[BayesFusion] wrote: Thu Jan 17, 2019 9:59 pm
I have problem with structure bayesian network learning using Naive Bayes algorithm. When I try to learn my network - .NET throws SmileException with error code -1.
How did you select the class variable?
Could you clarify more your question?
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with structure learning

Post by shooltz[BayesFusion] »

Naive Bayes algorithm needs to know which variable in your dataset is a class variable. In SMILE.NET you can specify the class variable by setting the NaiveBayes.ClassVariableId property. The class variable identifier should be matched by one of the variables in the dataset passed as a parameter to NaiveBayes.Learn. However, your data file has no header with variable identifiers; you'll need to add this before proceeding.

Also, make sure your dataset has variables with at least two distinct values (missing entries do not count as distinct).

You may want to use Naive Bayes in GeNIe before proceeding with SMILE.NET. Its implementation shares the code included in SMILE.NET. You'll need to add these variable identifiers as a header to your .csv before loading it into GeNIe.
mch
Posts: 3
Joined: Wed Jan 16, 2019 5:26 pm

Re: Problem with structure learning

Post by mch »

shooltz[BayesFusion] wrote: Fri Jan 18, 2019 1:16 pm Naive Bayes algorithm needs to know which variable in your dataset is a class variable. In SMILE.NET you can specify the class variable by setting the NaiveBayes.ClassVariableId property. The class variable identifier should be matched by one of the variables in the dataset passed as a parameter to NaiveBayes.Learn. However, your data file has no header with variable identifiers; you'll need to add this before proceeding.

Also, make sure your dataset has variables with at least two distinct values (missing entries do not count as distinct).

You may want to use Naive Bayes in GeNIe before proceeding with SMILE.NET. Its implementation shares the code included in SMILE.NET. You'll need to add these variable identifiers as a header to your .csv before loading it into GeNIe.
I switched to using Greedy Thick Thinning algorithm. I set MaxParents property to 8 and it still throw SmileException with error code -1. I tried my dataset with GeNIe and Greedy Thick Thinning algorithm and it works pretty well. I still don't know why it's not working. Any thoughts?
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with structure learning

Post by shooltz[BayesFusion] »

I tried my dataset with GeNIe and Greedy Thick Thinning algorithm and it works pretty well
Your data file contains columns with missing values, which are not compatible with Greedy Thick Thinning. Unless you've switched to another data file, GeNIe should tell you about the problems with your data.
Post Reply