Pages: [1]
Author Topic: Extend MissingVelueReplenishment with median calculations  (Read 2006 times)
Posts: 2

« on: October 19, 2008, 11:11:23 AM »

Hello Folks,

I want to extend the operator "mssingValueReplenishment" with the possibility to calculate the median of a given attribute. I dont't really know how to start my coding.

Here the steps i did so far:

1) Extend the cases in
                                         MissingValueReplenishment.public double getReplenishmentValue(int functionIndex, ExampleSet exampleSet, Attribute                attribute, double currentValue, String valueString)   with

case MEDIAN:
            return exampleSet.getStatistics(attribute, Statistics.MEDIAN);

2) In addition to that in the interface "statistics"  i'have added

 public static final String MEDIAN   = "median"

The attributes in my exampleSet are numerical by nature, so i think the key to solving my problem belongs to

3) NumericalStatistics.count(Attribute a) - Here the variance and the mean are calculated for the given attribute.
But now I don't know to go on.

I would be glad if someone has a tip how to proceed.

Thanks very much an best wishes,

Tobias Malbrecht
Global Moderator
Sr. Member
Posts: 293

« Reply #1 on: October 19, 2008, 03:21:46 PM »

Hello Maik,

in principal, you could extend the NumericalStatistics to calculate the median as well. But from my point of view, I think for you it would be easier to simply calculate the median in the method getReplenishmentValue(...) from the data. Everything you need (example set, attribute) is available in that method, so no new methods etc. have to be added. This way however has the disadvantage of an additional data scan, but it is much easier to implement.

Hope that helps,

Tobias Malbrecht
Director of Product Marketing
Pages: [1]
Jump to: