Hello All,

I am using Weka and I have a list of words which are by default saved as Nominal. But, I want them to be Strings. On the other hand, Naive Bayes classifier can not handle String values. So, I have decided to use two filters. I should Firstly filter my .csv data and change Nominals to Strings and then change Strings to WordVectors.

For the first part, I am using the following code. But, when I look at the created file, I still see my attribute which is saved as Nominal.

Here is my code:


 String file = "G:\\1_training_feats.csv";
        String res_file = "G:\\training_set_without_nominals.arff";

        // load CSV
        CSVLoader loader = new CSVLoader();
        loader.setSource(new File(file));
        Instances data = loader.getDataSet();

        NominalToString filter1 = new NominalToString();
        filter1.setInputFormat(data);
        data = Filter.useFilter(data, filter1);

   // save ARFF
        ArffSaver saver = new ArffSaver();
        saver.setInstances(data);
        saver.setFile(new File(res_file));
        saver.writeBatch();

I face no error and I get the "res_file" created, but still the type of the attributes are Nominal). Also, I tried to load the "res_file" which is an arff file to do the filtering on that data. But, again I got the same results, a file including nominal types.

Can anybody please tell me what is wrong with my code?



Best,
Farhaneh