Resampling with class value

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

Resampling with class value

Paulo Ferreira
Hello, all!!

I have a dataset that has 2 classes: normal and attack.

In order to model a behaviour-based IDS, I want to split the dataset into training and test sets, but I want that the training set only has instances with class normal; the test set will contain the remaining instances.

1) Is this possible with Weka?
2) How can I do that using the Weka Java API?

Thank you very much for your help,

Paulo Ferreira

_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: 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: Resampling with class value

Peter Reutemann
> I have a dataset that has 2 classes: normal and attack.
>
> In order to model a behaviour-based IDS, I want to split the dataset into training and test sets, but I want that the training set only has instances with class normal; the test set will contain the remaining instances.
>
> 1) Is this possible with Weka?
> 2) How can I do that using the Weka Java API?

You can use either of the following filters to achieve this:
- RemoveWithValues
  https://weka.sourceforge.io/doc.dev/weka/filters/unsupervised/instance/RemoveWithValues.html
- SubsetByExpression
  https://weka.sourceforge.io/doc.dev/weka/filters/unsupervised/instance/SubsetByExpression.html

Check out the "Use Weka in your Java code" article, section "Filter":
https://waikato.github.io/weka-wiki/use_weka_in_your_java_code/

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 858-5174
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: 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