I replaced that function with the class GCSVParser. I need to update the docs to reflect this change. Thanks for pointing it out.
The GCSVParser class provides better error reporting and improved functionality. For example, you can specify date-stamp formats, or the types of ambiguous columns. Here is some example usage:
GMatrix m;
GCSVParser p;
p.parse(m, "somefile.csv");
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks, I realized the class. Additionally, hoe can I define the type of a column
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2015-04-29
If you want to tell it how to interpret the columns in a CSV file, then...
To specify that column i should be evaluated as continuous, call GCSVParser::setRealAttr(i).
To specify that column i should be evaluated as categorical, call GCSVParser::setNominalAttr(i).
Integer types should usually be evaluated as real. Binary types should be evaluated as nominal. For date-stamps, call GCSVParser::setTimeFormat(format), where format is a string such as "YYYY-MM-DD hh:mm:ss".
If you want to create an uninitialized GMatrix with specified column types, then...
Here is an example that will create a matrix with 7 rows and 3 columns, where column 0 is binary, column 1 is real, and column 2 has 10 classes:
In the http://waffles.sourceforge.net/docs/matrices.html , there is a function loadCsv but as far as I see from the code, it is not implemented in the latest version.
I replaced that function with the class GCSVParser. I need to update the docs to reflect this change. Thanks for pointing it out.
The GCSVParser class provides better error reporting and improved functionality. For example, you can specify date-stamp formats, or the types of ambiguous columns. Here is some example usage:
GMatrix m;
GCSVParser p;
p.parse(m, "somefile.csv");
Thanks, I realized the class. Additionally, hoe can I define the type of a column
If you want to tell it how to interpret the columns in a CSV file, then...
To specify that column i should be evaluated as continuous, call GCSVParser::setRealAttr(i).
To specify that column i should be evaluated as categorical, call GCSVParser::setNominalAttr(i).
Integer types should usually be evaluated as real. Binary types should be evaluated as nominal. For date-stamps, call GCSVParser::setTimeFormat(format), where format is a string such as "YYYY-MM-DD hh:mm:ss".
If you want to create an uninitialized GMatrix with specified column types, then...
Here is an example that will create a matrix with 7 rows and 3 columns, where column 0 is binary, column 1 is real, and column 2 has 10 classes:
vector<size_t> cols;
cols.push_back(2);
cols.push_back(0);
cols.push_back(10);
GMatrix M(cols);
M.newRows(7);