[Numpy-discussion] in the NA discussion, what can we agree on?

Lluís xscript at gmx.net
Fri Nov 4 12:50:03 EDT 2011


Benjamin Root writes:

> On Fri, Nov 4, 2011 at 11:08 AM, Lluís <xscript at gmx.net> wrote:

>     Gary Strangman writes:
>     [...]
   
>> destructive + non-propagating = the data point is truly missing, this is the
>> nature of that data point, such missingness should be replicated in elementwise
>> operations, but such missingness should NOT interfere with reduction operations
>> that involve that datapoint (np.sum([1,MISSING])=1)
   
>     What do you define as element-wise operations?
   
>     Is a sum on an array an element-wise operation?
   
>      >>> [1, MISSING]+2
>      [1, MISSING]

> did you mean [3, MISSING]?

Yes, sorry.


>     Or is it just a form of reduction (after shape broadcasting)?
   
>      >>> [1, MISSING]+2
>      [3, 2]
   
>     For me it's the second, so the only time where special values "propagate" in a
>     non-propagating scenario is when you slice an array.

> Propagation has a very specific meaning here, and I think it is causing confusion elsewhere.  Propagation (to me) is the *exact* same behavior that occurs
> with NaNs, but generalized to any dtype.  It seems like you are taking "propagate" to mean whether the mask of the inputs follow on to the mask of the
> output.  This is related, but is possibly a murkier concept and should probably be cleaned up.

If you ignore the existence of a mask (as it is a specific mechanism for
handling the destructiveness, not the propagation), I think we both think of the
same concept of propagation:

High-level:

   x + SPECIAL

Propagating (SPECIAL => NaN-like => MISSING):

   x + SPECIAL = SPECIAL

Non-propagating (SPECIAL => ignore this element, similar to nansum => IGNORE):

   x + SPECIAL = x


Is there an agreement on this, or am I missing something else?


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



More information about the NumPy-Discussion mailing list