How to specify bin edges for discretization

The engine.
Post Reply
petcai
Posts: 20
Joined: Fri Nov 01, 2013 1:22 am

How to specify bin edges for discretization

Post by petcai »

I would like to specify bin edges for discretization. The following is my code:
vector<double> vctEdge;
vctEdge.push_back(21.0);
vctEdge.push_back(31.0);
vctEdge.push_back(41.0);
vctEdge.push_back(51.0);
vctEdge.push_back(61.0);
vctEdge.push_back(66.0);
vctEdge.push_back(71.0);
vctEdge.push_back(76.0);
vctEdge.push_back(81.0);
vctEdge.push_back(86.0);
vctEdge.push_back(91.0);
dataset.Discretize(1,DSL_dataset::DiscretizeAlgorithm::UniformWidth,12,"ss",vctEdge);

The above code gives me errors:
Assertion failed: output.empty(), file discretizer.cxx, line 18

However, in Genie, one can really modify the bin edges for discretization. I am wondering how can I do that in Smile/arn. Thanks.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: How to specify bin edges for discretization

Post by shooltz[BayesFusion] »

However, in Genie, one can really modify the bin edges for discretization. I am wondering how can I do that in Smile/arn. Thanks.
The bug you've found will be fixed in the upcoming SMILE release; in the meantime the only way to discretize is through DSL_discretizer class (that's what GeNIe uses).
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: How to specify bin edges for discretization

Post by shooltz[BayesFusion] »

One more thing: SMILearn does not provide any means for explicit bin edges; the DSL_discretizer class calculates these. The actual assignment of values into bins is not available in SMILearn (as it's quite simple to perform).
petcai
Posts: 20
Joined: Fri Nov 01, 2013 1:22 am

Re: How to specify bin edges for discretization

Post by petcai »

Thanks, shooltz.

Could you please also provide any hints on how Genie allow users to modify bin edges for discretization? I really need to specify the bin edges manually rather than automatically by DSL_discretizer. Thanks.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: How to specify bin edges for discretization

Post by shooltz[BayesFusion] »

petcai wrote:Could you please also provide any hints on how Genie allow users to modify bin edges for discretization?
I'm not sure I understand this part of your question - are you asking about the GUI implementation details (the Win32/MFC specific stuff)?
I really need to specify the bin edges manually rather than automatically by DSL_discretizer.
At this time there's no SMILearn entrypoint for that. If you know the edges, then simply iterate over the entries in the data column and assign each float value into appropriate bin defined by the edges.
petcai
Posts: 20
Joined: Fri Nov 01, 2013 1:22 am

Re: How to specify bin edges for discretization

Post by petcai »

Thanks, shooltz. I am asking the functionalities rather than the gui. Now I understand how to do it.
Post Reply