Problem with AddFloatVar() and SetFloat() in DSL_datasest

The engine.
Post Reply
oscarpc
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Problem with AddFloatVar() and SetFloat() in DSL_datasest

Post by oscarpc »

Hi all,

I am experiencing some problems with fields that are '"floats" in a DSL_dataset.
For example, float data are always printed as missing values when using PrintDataset. That is, whenever I asked if a float value is missing "(ds.IsMissing(v,r))" , it is always true!!!!
Furthermore, when I use the ds.Discretize function, it is unable to do anything for floats. Has anyone experienced the same problems?
Thank you very much in advance.

Here I put a piece of my code:

DSL_dataset ds;

// AddIntVar/AddFloatVar are the methods that allow to
// add variables with
// corresponding data records. The first variable added
// in this way determines the number of records for the
// following variables.
ds.AddFloatVar("WBC");
ds.AddIntVar("Sodium");
ds.AddIntVar("Age");
ds.AddIntVar("RDH");

ds.SetNumberOfRecords(WBC.size());
ds.SetNumberOfRecords(5);

unsigned x;
for(x=0;x<5;++x)
{
ds.SetFloat(0,x,WBC[x].value);
ds.SetInt(1,x,Sodium[x].value);
ds.SetInt(2,x,Age[x].value);
ds.SetInt(3,x,RDH[x].value);
}
// Method for printing content of a data set on the screen
// This method is provided below.
PrintDataset(ds);



DSL_discretizer disc(ds.GetFloatData(0));
std::vector<double> be;
disc.Discretize(disc.Hierarchical,3,be);
cout << "Bin edges: " << endl;

unsigned i;


//Discretization can also be done within the DSL_dataset
//But this will modify it.
be.clear();
ds.Discretize(1,ds.Hierarchical,3,"State_",be);
PrintDataset(ds);

for (i=0;i<be.size();i++)
{
cout << be << " ";
cout << endl << endl;
}
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by shooltz[BayesFusion] »

oscarpc wrote:That is, whenever I asked if a float value is missing "(ds.IsMissing(v,r))" , it is always true!!!!
Check the contents of your 'WBC' vector.
oscarpc
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by oscarpc »

Hello!
Thank you very much for your reply.

I did check the content of my vector already.
I printed the values of my WBC vector and they are the original float (double) numbers that I read from my dataset.
I don't know what else I can do.
Did you have this problem in the past? If so, what was the reason?

Thank you so much again.

Cheers.
Oscar
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by shooltz[BayesFusion] »

oscarpc wrote:Did you have this problem in the past? If so, what was the reason?
No, this is the first time. Which compiler version you're using?
oscarpc
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by oscarpc »

I am programming with Eclipse in a Mac. My compiler is Cross GCC.
Thank you very much for your help.

Oscar PC.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by shooltz[BayesFusion] »

oscarpc wrote:I am programming with Eclipse in a Mac. My compiler is Cross GCC.
What's the output from "gcc --version" ?
oscarpc
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by oscarpc »

Thanks for your reply.
It says i686-apple-darwin10-gcc-4.2.1

Kind regards,
Oscar PC
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by shooltz[BayesFusion] »

I can reproduce this behavior with gcc - stay tuned.
oscarpc
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by oscarpc »

Dear colleagues,
Do you have any news with regard to this problem?
I don't mean to put pressure, just to know if you have any update.

Thank you very much.
Kind regards,
Oscar
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by shooltz[BayesFusion] »

oscarpc wrote:Do you have any news with regard to this problem?
The bug is fixed, but I need to install developer tools on the available OSX machine. New SMILE builds will go public this week, starting with Win32 ones.
oscarpc
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by oscarpc »

That's good news.
Thank you very much.
Oscar PC
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by shooltz[BayesFusion] »

New SMILE build for OSX just went online. We use the most recent toolset from Xcode 4.5, "g++ --version" outputs the following line:
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
oscarpc
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by oscarpc »

Dear colleagues,

It is me again back with this problem.
I have recently installed the SMILE libraries in Linux with gcc 4.6.3 and I encountered that the two functions, AddFloatVar() and SetFloat() do not work.

Thank you very much.
Kind regards,

Oscar
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Problem with AddFloatVar() and SetFloat() in DSL_datases

Post by shooltz[BayesFusion] »

oscarpc wrote:I have recently installed the SMILE libraries in Linux with gcc 4.6.3
On Linux, the supported gcc versions are 4.4.5 and 3.4.6.
Post Reply