Problem compiling code from Smilearn tutorial

The engine.
Post Reply
Mauro
Posts: 3
Joined: Sat Jan 31, 2009 4:45 pm
Location: Chile

Problem compiling code from Smilearn tutorial

Post by Mauro »

I compiled and used with no problem the code from the Smile tutorial in the wiki. However, when doing this for the first Smilearn tutorial i get the following from make:

g++ -O3 -DNDEBUG -ffast-math -c smile.C -I../include_gcc_411
smile.C: In function ‘void PrintDataset(const DSL_dataset&)’:
smile.C:41: error: ‘const class DSL_dataset’ has no member named ‘NumVariables’
smile.C:42: error: ‘const class DSL_dataset’ has no member named ‘NumVariables’
smile.C:44: error: ‘DSL_variableInfo’ was not declared in this scope
smile.C:44: error: expected `;' before ‘vi’
smile.C:45: error: ‘vi’ was not declared in this scope
smile.C:68: error: ‘const class DSL_dataset’ has no member named ‘NumRecords’
smile.C:69: error: ‘const class DSL_dataset’ has no member named ‘NumRecords’
smile.C:71: error: ‘const class DSL_dataset’ has no member named ‘NumVariables’
smile.C:78: error: ‘const class DSL_dataset’ has no member named ‘At’
smile.C:80: error: ‘const class DSL_dataset’ has no member named ‘At’
smile.C: In function ‘void CreateDataset()’:
smile.C:111: error: invalid conversion from ‘std::vector<int, std::allocator<int> >*’ to ‘int’
smile.C:111: error: initialising argument 2 of ‘int DSL_dataset::AddIntVar(std::string, int)’
smile.C:112: error: no matching function for call to ‘DSL_dataset::AddFloatVar(const char [7], std::vector<float, std::allocator<float> >*)’
../include_gcc_411/dataset.h:65: note: candidates are: int DSL_dataset::AddFloatVar(std::string, float)
smile.C:120: error: ‘DSL_dataElement’ was not declared in this scope
smile.C:120: error: template argument 1 is invalid
smile.C:120: error: template argument 2 is invalid
smile.C:120: error: invalid type in declaration before ‘(’ token
smile.C:120: error: ‘class DSL_dataset’ has no member named ‘NumVariables’
smile.C:121: error: invalid types ‘int[int]’ for array subscript
smile.C:122: error: invalid types ‘int[int]’ for array subscript
smile.C:123: error: ‘class DSL_dataset’ has no member named ‘AddRecord’
make: *** [smile.o] Error 1

Searching with grep, for example, for NumVariables in the header files i actually didn't find it, but the similar GetNumberOfVariables(). This replacement actually spared me the errors for Numvariables, but the replacemente for the other errors dont appear to be so obvious.I'm thinking maybe there's been changes in the code that haven't been updated in the tutorial??

Thanks in advance for any help, and as this is my first post, i also would like to thank everyone behind Genie/Smile for providing the community with such an awesome tool! ;)

ps: My Makefile:

CFLAGS = -O3 -DNDEBUG -ffast-math
CC = g++
SMILE = ../include_gcc_411
LFLAGS = -L$(SMILE) -lsmile -lsmilearn

default: smile

smile: smile.o
$(CC) $(CFLAGS) smile.o -o smile $(LFLAGS)

smile.o: smile.C
$(CC) $(CFLAGS) -c smile.C -I$(SMILE)

clean:
rm -rf *.o smile
mark
Posts: 179
Joined: Tue Nov 27, 2007 4:02 pm

Post by mark »

There have been some changes in the public API of SMILE, but the tutorials have not been updated yet. NumVariables has been replaced with GetNumberOfVariables, NumRecords has been replaced with GetNumberOfRecords, and At has been replaced with GetInt/GetFloat. Please see dataset.h for more information.
Mauro
Posts: 3
Joined: Sat Jan 31, 2009 4:45 pm
Location: Chile

Post by Mauro »

I did look at it briefly, and now will look with more depth. Still, if you could tell me about how to replace DSL_variableInfo and DSL_dataElement i think it would be a great help.

Thanks for the quick response!
mark
Posts: 179
Joined: Tue Nov 27, 2007 4:02 pm

Post by mark »

DSL_variableInfo has been replaced by DSL_datasetVarInfo. You can use GetFloat/GetFloat to retrieve data set values instead of DSL_dataElement which has been removed.
Mauro
Posts: 3
Joined: Sat Jan 31, 2009 4:45 pm
Location: Chile

Post by Mauro »

I forgot to ask if there is some code available that works with the last version of the code; nothing fancy as in the tutorial perhaps, but something that will easily compile and run to perform some inference??
mark
Posts: 179
Joined: Tue Nov 27, 2007 4:02 pm

Post by mark »

The tutorials are supposed to be our examples, so I guess we should really update them. I'd be glad to help you develop a simple example though.
ermutarra
Posts: 17
Joined: Fri Apr 24, 2009 1:19 pm

Problems compiling Smilearn tutorial

Post by ermutarra »

Hi,

I'm having the same problems Mauro had.
It would be great if you could update the wiki and the tutorials.

In the meantime... how can I fix ‘struct DSL_datasetVarInfo’ has no member named ‘missingValue’?

Thanks for providing such a great tool!

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

Re: Problems compiling Smilearn tutorial

Post by shooltz[BayesFusion] »

ermutarra wrote:In the meantime... how can I fix ‘struct DSL_datasetVarInfo’ has no member named ‘missingValue’?
DSL_datasetVarInfo::missingValue was replaced by missingInt and missingFloat.
snhemanthm
Posts: 1
Joined: Thu Mar 25, 2010 7:53 pm

AddIntVar and AddFloatVar

Post by snhemanthm »

Hi,

Could you also help out with the methods for adding a vector to a dataset.

AddIntVar and AddFloatVar don't seem to accept vectors anymore.

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

Re: AddIntVar and AddFloatVar

Post by shooltz[BayesFusion] »

snhemanthm wrote:AddIntVar and AddFloatVar don't seem to accept vectors anymore.
You need to iterate over the vector and call SetInt/SetFloat with appropriate parameters. If the dataset row count is different from vector's size, use AddEmptyRecord or RemoveRecord.
Post Reply