Import of csv and excel-files into WEKA

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Import of csv and excel-files into WEKA

Jens
Dear all!

First of all, I want to thank you for creating the weka program! I like it.
But I always have problems in working with imported files like csv or excel. Having imported an csv file it is not possible to apply any of the classifyers an d so on. Could you support me in solving this problem? Thank you in advance.

Best regards
Jens
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Michael Hall


> On Nov 26, 2020, at 4:35 PM, Jens <[hidden email]> wrote:
>
> Dear all!
>
> First of all, I want to thank you for creating the weka program! I like it.
> But I always have problems in working with imported files like csv or excel. Having imported an csv file it is not possible to apply any of the classifyers an d so on. Could you support me in solving this problem? Thank you in advance.
>
> Best regards
> Jens
> ______________________________________________

I usually convert csv to arff before using Weka. If you are converting on the fly I think you could save off the resulting arff representation.
I would verify it follows the usual Weka conventions of the class to predict being the last field and missing values represented by ?


_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Peter Reutemann
In reply to this post by Jens
> First of all, I want to thank you for creating the weka program! I like it.
> But I always have problems in working with imported files like csv or excel. Having imported an csv file it is not possible to apply any of the classifyers an d so on. Could you support me in solving this problem? Thank you in advance.

Classifiers can only handle certain types of data. Click the
"Capabilities" button when editing a classifier's options.
The attribute types you can view in the Preprocess panel (see
"Selected attribute" box).
When loading from a CSV file, it is possible that you may have had
numeric values as the class attribute (like 1, 2, 3, ...). The
CSVLoader doesn't know that these should be treated as categorical
ones. In other words, the dataset will get interpreted as one for
regression, disabling any algorithms for classification.

It is usually a good idea to convert the data to ARFF before
continuing to use it, as it stores the column types in its header.

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Edward Wiskers


It is usually a good idea to convert the data to ARFF before
continuing to use it, as it stores the column types in its header.

Hi Peter,

In your opinion, what is the best way to do this without using the code?

Thank you.

Edward 




Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Peter Reutemann-3
You load the file in the Weka Explorer, apply the appropriate filters in the preprocess panel and save it as ARFF file.

Cheers, Peter

On November 29, 2020 4:15:35 PM GMT+13:00, Edward Wiskers <[hidden email]> wrote:

>>
>> It is usually a good idea to convert the data to ARFF before
>> continuing to use it, as it stores the column types in its header.
>>
>
>Hi Peter,
>
>In your opinion, what is the best way to do this without using the
>code?
>
>Thank you.
>
>Edward
>
>>
>
>
>
>> Cheers, Peter
>> --
>> Peter Reutemann
>> Dept. of Computer Science
>> University of Waikato, NZ
>> +64 (7) 577-5304
>> http://www.cms.waikato.ac.nz/~fracpete/
>> http://www.data-mining.co.nz/
>> _______________________________________________
>> Wekalist mailing list -- [hidden email]
>> Send posts to [hidden email]
>> To unsubscribe send an email to [hidden email]
>> To subscribe, unsubscribe, etc., visit
>>
>https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
>> List etiquette:
>> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>>

--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Michael Hall
In reply to this post by Edward Wiskers


On Nov 28, 2020, at 9:15 PM, Edward Wiskers <[hidden email]> wrote:



It is usually a good idea to convert the data to ARFF before
continuing to use it, as it stores the column types in its header.

Hi Peter,

In your opinion, what is the best way to do this without using the code?

Thank you.
Han 
Edward 


Fwiw, I would usually read the csv file into R and then use RWeka write.arff 
Some data pre-processing for me maybe a little more convenient with R than with Weka filters


_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Edward Wiskers
In reply to this post by Peter Reutemann-3
Thank you Peter and Michael,

Peter, this is clear. However, is there any filter in Weka that allows modifying the data type (i.e., the header of the data)?

Michael, thank you for the clear answer. However, are there any resources (perhaps code) that you can share here that allow converting the CSV file via RWeka in order to write.ARFF format?

Cheers, 
Edward 

On Sun, Nov 29, 2020 at 11:28 AM Peter Reutemann <[hidden email]> wrote:
You load the file in the Weka Explorer, apply the appropriate filters in the preprocess panel and save it as ARFF file.

Cheers, Peter

On November 29, 2020 4:15:35 PM GMT+13:00, Edward Wiskers <[hidden email]> wrote:
>>
>> It is usually a good idea to convert the data to ARFF before
>> continuing to use it, as it stores the column types in its header.
>>
>
>Hi Peter,
>
>In your opinion, what is the best way to do this without using the
>code?
>
>Thank you.
>
>Edward
>
>>
>
>
>
>> Cheers, Peter
>> --
>> Peter Reutemann
>> Dept. of Computer Science
>> University of Waikato, NZ
>> +64 (7) 577-5304
>> http://www.cms.waikato.ac.nz/~fracpete/
>> http://www.data-mining.co.nz/
>> _______________________________________________
>> Wekalist mailing list -- [hidden email]
>> Send posts to [hidden email]
>> To unsubscribe send an email to [hidden email]
>> To subscribe, unsubscribe, etc., visit
>>
>https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
>> List etiquette:
>> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>>

--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Peter Reutemann-3
Look at the attribute filters, like StringToNominal etc.

Cheers, Peter

On November 29, 2020 4:58:20 PM GMT+13:00, Edward Wiskers <[hidden email]> wrote:

>Thank you Peter and Michael,
>
>Peter, this is clear. However, is there any filter in Weka that allows
>modifying the data type (i.e., the header of the data)?
>
>Michael, thank you for the clear answer. However, are there any
>resources (perhaps code) that you can share here that allow converting
>the
>CSV file via RWeka in order to write.ARFF format?
>
>Cheers,
>Edward
>
>On Sun, Nov 29, 2020 at 11:28 AM Peter Reutemann <[hidden email]>
>wrote:
>
>> You load the file in the Weka Explorer, apply the appropriate filters
>in
>> the preprocess panel and save it as ARFF file.
>>
>> Cheers, Peter
>>
>> On November 29, 2020 4:15:35 PM GMT+13:00, Edward Wiskers <
>> [hidden email]> wrote:
>> >>
>> >> It is usually a good idea to convert the data to ARFF before
>> >> continuing to use it, as it stores the column types in its header.
>> >>
>> >
>> >Hi Peter,
>> >
>> >In your opinion, what is the best way to do this without using the
>> >code?
>> >
>> >Thank you.
>> >
>> >Edward
>> >
>> >>
>> >
>> >
>> >
>> >> Cheers, Peter
>> >> --
>> >> Peter Reutemann
>> >> Dept. of Computer Science
>> >> University of Waikato, NZ
>> >> +64 (7) 577-5304
>> >> http://www.cms.waikato.ac.nz/~fracpete/
>> >> http://www.data-mining.co.nz/
>> >> _______________________________________________
>> >> Wekalist mailing list -- [hidden email]
>> >> Send posts to [hidden email]
>> >> To unsubscribe send an email to [hidden email]
>> >> To subscribe, unsubscribe, etc., visit
>> >>
>>
>>https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
>> >> List etiquette:
>> >> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>> >>
>>
>> --
>> Peter Reutemann
>> Dept. of Computer Science
>> University of Waikato, NZ
>> +64 (7) 577-5304
>> http://www.cms.waikato.ac.nz/~fracpete/
>> http://www.data-mining.co.nz/
>> _______________________________________________
>> Wekalist mailing list -- [hidden email]
>> Send posts to [hidden email]
>> To unsubscribe send an email to [hidden email]
>> To subscribe, unsubscribe, etc., visit
>>
>https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
>> List etiquette:
>> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>>

--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Edward Wiskers
Thank you so much Peter. This is very helpful.

I'm still waiting for Michael's answer on the following question: 

are there anyresources (perhaps code) that you can share here that allow converting
the CSV file via RWeka in order to write.ARFF format?

Cheers, 
Edward 


On Sun, 29 Nov 2020, 12:40 pm Peter Reutemann, <[hidden email]> wrote:
Look at the attribute filters, like StringToNominal etc.

Cheers, Peter

On November 29, 2020 4:58:20 PM GMT+13:00, Edward Wiskers <[hidden email]> wrote:
>Thank you Peter and Michael,
>
>Peter, this is clear. However, is there any filter in Weka that allows
>modifying the data type (i.e., the header of the data)?
>
>Michael, thank you for the clear answer. However, are there any
>resources (perhaps code) that you can share here that allow converting
>the
>CSV file via RWeka in order to write.ARFF format?
>
>Cheers,
>Edward
>
>On Sun, Nov 29, 2020 at 11:28 AM Peter Reutemann <[hidden email]>
>wrote:
>
>> You load the file in the Weka Explorer, apply the appropriate filters
>in
>> the preprocess panel and save it as ARFF file.
>>
>> Cheers, Peter
>>
>> On November 29, 2020 4:15:35 PM GMT+13:00, Edward Wiskers <
>> [hidden email]> wrote:
>> >>
>> >> It is usually a good idea to convert the data to ARFF before
>> >> continuing to use it, as it stores the column types in its header.
>> >>
>> >
>> >Hi Peter,
>> >
>> >In your opinion, what is the best way to do this without using the
>> >code?
>> >
>> >Thank you.
>> >
>> >Edward
>> >
>> >>
>> >
>> >
>> >
>> >> Cheers, Peter
>> >> --
>> >> Peter Reutemann
>> >> Dept. of Computer Science
>> >> University of Waikato, NZ
>> >> +64 (7) 577-5304
>> >> http://www.cms.waikato.ac.nz/~fracpete/
>> >> http://www.data-mining.co.nz/
>> >> _______________________________________________
>> >> Wekalist mailing list -- [hidden email]
>> >> Send posts to [hidden email]
>> >> To unsubscribe send an email to [hidden email]
>> >> To subscribe, unsubscribe, etc., visit
>> >>
>>
>>https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
>> >> List etiquette:
>> >> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>> >>
>>
>> --
>> Peter Reutemann
>> Dept. of Computer Science
>> University of Waikato, NZ
>> +64 (7) 577-5304
>> http://www.cms.waikato.ac.nz/~fracpete/
>> http://www.data-mining.co.nz/
>> _______________________________________________
>> Wekalist mailing list -- [hidden email]
>> Send posts to [hidden email]
>> To unsubscribe send an email to [hidden email]
>> To subscribe, unsubscribe, etc., visit
>>
>https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
>> List etiquette:
>> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>>

--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Michael Hall


On Nov 30, 2020, at 5:21 AM, Edward Wiskers <[hidden email]> wrote:

Thank you so much Peter. This is very helpful.

I'm still waiting for Michael's answer on the following question: 

are there anyresources (perhaps code) that you can share here that allow converting
the CSV file via RWeka in order to write.ARFF format?


Something like...

my_dataframe <- read.csv(“some.csv”)
write.arff(my_dataframe,”some.arff”)




_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Michael Hall


On Nov 30, 2020, at 8:48 AM, Michael Hall <[hidden email]> wrote:



On Nov 30, 2020, at 5:21 AM, Edward Wiskers <[hidden email]> wrote:

Thank you so much Peter. This is very helpful.

I'm still waiting for Michael's answer on the following question: 

are there anyresources (perhaps code) that you can share here that allow converting
the CSV file via RWeka in order to write.ARFF format?


Something like...

my_dataframe <- read.csv(“some.csv”)
write.arff(my_dataframe,”some.arff”)




Should of included first…

library(RWeka)

And if necessary before that 

install.packages(“RWeka”)



_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Edward Wiskers
Thanks Michael. Do you have the rest of code that does the process?

Edward

On Mon, 30 Nov 2020, 10:52 pm Michael Hall, <[hidden email]> wrote:


On Nov 30, 2020, at 8:48 AM, Michael Hall <[hidden email]> wrote:



On Nov 30, 2020, at 5:21 AM, Edward Wiskers <[hidden email]> wrote:

Thank you so much Peter. This is very helpful.

I'm still waiting for


answer on the following question: 

are there anyresources (perhaps code) that you can share here that allow converting
the CSV file via RWeka in order to write.ARFF format?


Something like...

my_dataframe <- read.csv(“some.csv”)
write.arff(my_dataframe,”some.arff”)




Should of included first…

library(RWeka)

And if necessary before that 

install.packages(“RWeka”)


_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Import of csv and excel-files into WEKA

Michael Hall


On Dec 5, 2020, at 7:44 PM, Edward Wiskers <[hidden email]> wrote:

Thanks Michael. Do you have the rest of code that does the process?

Edward

Any other code would be related to what processing of the data you want to do. 
It would be specific to the data and the R knowledge of the user. 
Not specific to Weka. So omitted as off-topic.
What I provided was about all there is to using RWeka for csv conversion.


_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html