Hi,
I'm having trouble loading a data file and I have a few questions about this.
1. Do the variable names have to be in the first row? Can it not load a data file that does not have the variable names in the first row?
2. Do the variable states have to be a string? Can they not be numbers?
My data file for now is just:
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
But DSL_dataset's ReadFile method fails.
3. Now that there is no parser anymore how does the ReadFile know whether the variables are discrete or continuous?
Thank you for your help!
ermutarra
Questions about DSL_dataset's ReadFile method
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Questions about DSL_dataset's ReadFile method
Such data can be loaded, you just need to override the default parse parameters passed to DSL_dataset::ReadFile.ermutarra wrote:1. Do the variable names have to be in the first row? Can it not load a data file that does not have the variable names in the first row?
Code: Select all
DSL_datasetParseParams params;
params.columnIdsPresent = false;
int res = dataset.ReadFile(filename, ¶ms);
They can be numbers. Your file doesn't load, because the first row to be considered to be column name, and there's repeated '1' in the first row. See the answer to your question 1 on how to force the parser to use first row as data (not the header).2. Do the variable states have to be a string? Can they not be numbers? My data file for now is just:
1 1 1 1
2 2 2 2
...
We use simple algorithm for that. If column contains at least one non-numeric value, it's considered to be discrete. If column contains all numeric values, it's discrete if all numbers are integers.3. Now that there is no parser anymore how does the ReadFile know whether the variables are discrete or continuous?
Hi, I just started to make some tests with ReadFile copying the basic tutorial as following:
And test2.txt has the example values:
So I just got false, and I exit in the ExitProcess statement.
If i change the default params setting DSL_datasetParseParams::columnIdsPresent to false, and delete the first row c x y, It loads correctly.
Can anyone tell me what I'm doing wrong?
thank u very much
Code: Select all
DSL_dataset dataset;
std::string filename="D:\\test2.txt";
if (!dataset.ReadFile(filename))
ExitProcess(0);
Code: Select all
c x y
State1 State1 State0
State1 State1 State0
State0 State1 State1
State0 State0 State0
State0 State0 State1
State0 State0 State1
State0 State1 State0
State0 State0 State1
State0 State1 State1
State0 State1 State1
If i change the default params setting DSL_datasetParseParams::columnIdsPresent to false, and delete the first row c x y, It loads correctly.
Can anyone tell me what I'm doing wrong?
thank u very much
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
hi
thanks for the right DSL_dataset::ReadFile..
_________________
California Orange County Lawyer | Custom banner
_________________
California Orange County Lawyer | Custom banner