문제

I'm trying to understand how the following .arff file can be expressed in Weka when loading data from database instead of the file. An .arff file has the following form:

@relation sample
@attribute expression string
@attribute tone {postive,negative}

@data
'this is a happy message', positive
'this is an unhappy message', negative

In the case of loading data from a database, consisting of one table with two fields - expression and tone - , how can I let weka know that the field tone gets only two possible values, positive or negative ?

Both of the fields are Strings. I want to apply NominalToString filter on expression to convert it to String and the apply StringToWord filter. However because of the tone attribute it can't be done... Any solutions?

도움이 되었습니까?

해결책

I asked same question before. You may see detailed answer and necessary code in that question.

short answer : you merge correct arff header from external file with data from database.

다른 팁

"However because of the tone attribute it can't be done..." -- I don't see why. You could process only the 'expression' field. You could apply NominalToString selectively on whatever attributes you want. Check the setAttributeIndexes function out.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top