How to use unsupervised.attribute.AddValues?

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

How to use unsupervised.attribute.AddValues?

Chaitanya Birudavolu
Hi,

I'm trying to add an a attribute called "myclass", to the iris dataset, and assign the value "mysetosa" to this attribute (for all instances).

First, I added the attribute with "weka.filters.unsupervised.attribute.Add -T NOM -N myclass -L mysetosa -C last".

This creates the attribute at the last position, with missing values in all instances.

Next, I run a filter to change the value from missing to "mysetosa" for the new attribute, for all instances. For this, I use "weka.filters.unsupervised.attribute.AddValues -C last -L mysetosa".

But nothing happens. The values of this new attribute remain as missing, and there is no error message either.

One other observation is that, each time I click on "Apply" for applying the above filter (AddValues), the console shows one line of output with the following message "selected <Use an artificial time index>

Could you please help me convert the missing values to "mysetosa" in the new attribute. Is there something wrong in the way I'm using the AddValues filter?

I'm using Weka 3.8.1

Thanks very much !

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

Re: How to use unsupervised.attribute.AddValues?

Peter Reutemann
> I'm trying to add an a attribute called "myclass", to the iris dataset, and assign the value "mysetosa" to this attribute (for all instances).
>
> First, I added the attribute with "weka.filters.unsupervised.attribute.Add -T NOM -N myclass -L mysetosa -C last".
>
> This creates the attribute at the last position, with missing values in all instances.
>
> Next, I run a filter to change the value from missing to "mysetosa" for the new attribute, for all instances. For this, I use "weka.filters.unsupervised.attribute.AddValues -C last -L mysetosa".
>
> But nothing happens. The values of this new attribute remain as missing, and there is no error message either.
>
> One other observation is that, each time I click on "Apply" for applying the above filter (AddValues), the console shows one line of output with the following message "selected <Use an artificial time index>
>
> Could you please help me convert the missing values to "mysetosa" in the new attribute. Is there something wrong in the way I'm using the AddValues filter?

I think you may have misunderstood what AddValues does:
"Adds the labels from the given list to an attribute if they are missing"
http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/AddValues.html
In other words, it modifies the labels that are defined for an
attribute (ie extending the list of available labels), it doesn't
update any missing values in your data.

You might want to use the following filter: ReplaceMissingWithUserConstant
http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/ReplaceMissingWithUserConstant.html
NB: I've never used that filter.

Or you can use the "missing-values-imputation-weka-package" package:
https://github.com/fracpete/missing-values-imputation-weka-package
Select the "UserSuppliedValues" scheme for the
"weka.filters.unsupervised.attribute.MissingValuesImputation" filter.

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
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use unsupervised.attribute.AddValues?

Chaitanya Birudavolu
In reply to this post by Chaitanya Birudavolu
Thanks very much Peter.

After having struggled for some time, I did have this sneaking suspicion that I might have misunderstood, and that the real meaning might be as you clarified.

I checked for more info in Ian Wiitten 's eBook (the Appendix that describes Weka), and it had the same terse description about AddValues.

But I sure don't blame myself for the misunderstanding, I think that line of documentation should be changed to avoid this potential misunderstanding.

Thanks for clarifying (and for the alternatives you suggested) !

Cheers,
Chaitanya

--------------------------------------------
On Sat, 12/1/18, Peter Reutemann <[hidden email]> wrote:

 Subject: Re: [Wekalist] How to use unsupervised.attribute.AddValues?
 To: "weka List" <[hidden email]>
 Date: Saturday, December 1, 2018, 2:15 AM
 
 > I'm trying to add an a attribute
 called "myclass", to the iris dataset, and assign
 the value "mysetosa" to this attribute (for all
 instances).
 >
 > First,
 I added the attribute with
 "weka.filters.unsupervised.attribute.Add -T NOM -N
 myclass -L mysetosa -C last".
 >
 > This creates the attribute at the last
 position, with missing values in all instances.
 >
 > Next, I run a filter
 to change the value from missing to "mysetosa" for
 the new attribute, for all instances. For this, I use
 "weka.filters.unsupervised.attribute.AddValues -C last
 -L mysetosa".
 >
 >
 But nothing happens. The values of this new attribute remain
 as missing, and there is no error message either.
 >
 > One other observation
 is that, each time I click on "Apply" for applying
 the above filter (AddValues), the console shows one line of
 output with the following message "selected <Use an
 artificial time index>
 >
 > Could you please help me convert the
 missing values to "mysetosa" in the new attribute.
 Is there something wrong in the way I'm using the
 AddValues filter?
 
 I
 think you may have misunderstood what AddValues does:
 "Adds the labels from the given list to an
 attribute if they are missing"
 http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/AddValues.html
 In other words, it modifies the labels that are
 defined for an
 attribute (ie extending the
 list of available labels), it doesn't
 update any missing values in your data.
 
 You might want to use the
 following filter: ReplaceMissingWithUserConstant
 http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/ReplaceMissingWithUserConstant.html
 NB: I've never used that filter.
 
 Or you can use the
 "missing-values-imputation-weka-package"
 package:
 https://github.com/fracpete/missing-values-imputation-weka-package
 Select the "UserSuppliedValues"
 scheme for the
 "weka.filters.unsupervised.attribute.MissingValuesImputation"
 filter.
 
 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
 Send
 posts to: [hidden email]
 To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
 List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
 
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html