Problem with AddFloatVar() and SetFloat() in DSL_datasest
Problem with AddFloatVar() and SetFloat() in DSL_datasest
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;
}
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;
}
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
Check the contents of your 'WBC' vector.oscarpc wrote:That is, whenever I asked if a float value is missing "(ds.IsMissing(v,r))" , it is always true!!!!
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
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
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
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
No, this is the first time. Which compiler version you're using?oscarpc wrote:Did you have this problem in the past? If so, what was the reason?
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
I am programming with Eclipse in a Mac. My compiler is Cross GCC.
Thank you very much for your help.
Oscar PC.
Thank you very much for your help.
Oscar PC.
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
What's the output from "gcc --version" ?oscarpc wrote:I am programming with Eclipse in a Mac. My compiler is Cross GCC.
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
Thanks for your reply.
It says i686-apple-darwin10-gcc-4.2.1
Kind regards,
Oscar PC
It says i686-apple-darwin10-gcc-4.2.1
Kind regards,
Oscar PC
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
I can reproduce this behavior with gcc - stay tuned.
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
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
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
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
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 wrote:Do you have any news with regard to this problem?
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
That's good news.
Thank you very much.
Oscar PC
Thank you very much.
Oscar PC
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
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)
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
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
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
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Problem with AddFloatVar() and SetFloat() in DSL_datases
On Linux, the supported gcc versions are 4.4.5 and 3.4.6.oscarpc wrote:I have recently installed the SMILE libraries in Linux with gcc 4.6.3