avg operator with just one input

View: New views
4 Messages — Rating Filter:   Alert me  

avg operator with just one input

by Patrick Ohly-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

stupid question, but how do I calculate the average of all values in a
data source? The following has no effect because the operator by default
is only applied to matching values of different inputs (operator/match
attribute), and here I only have one input:

  <operator id="op.average" type="avg">
    <input>src.offset</input>
  </operator>

  <output target="raw_text">
    <input>op.average</input>
  </output>

--
Best Regards

Patrick Ohly
Senior Software Engineer

Intel GmbH
Software & Solutions Group                
Hermuelheimer Strasse 8a                  Phone: +49-2232-2090-30
50321 Bruehl                              Fax: +49-2232-2090-29
Germany

Intel GmbH, Dornacher Strasse 1, 85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456
Ust.- IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: avg operator with just one input

by Joachim Worringen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Patrick Ohly schrieb:

> Hello,
>
> stupid question, but how do I calculate the average of all values in a
> data source? The following has no effect because the operator by default
> is only applied to matching values of different inputs (operator/match
> attribute), and here I only have one input:
>
>   <operator id="op.average" type="avg">
>     <input>src.offset</input>
>   </operator>
>
>   <output target="raw_text">
>     <input>op.average</input>
>   </output>

As you described, when you apply the avg operator on data that comes
from a source, it will calculate the average on all result values with
the same set of parameters - reducing multiple data vectors to a single
data vector. In contrast, wenn applying this operator to a data vector
coming from an operator (an operator always emitts a single data
vector), it will reduce this vector to a scalar.

So, just place another avg operator between op.average and the output,
and you should have what you want.

  Joahcim

--
Joachim Worringen, Software Architect, Dolphin Interconnect Solutions
phone ++49/(0)228/324 08 17 - http://www.dolphinics.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: avg operator with just one input

by Patrick Ohly-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2007-03-16 at 12:42 +0100, Joachim Worringen wrote:
> As you described, when you apply the avg operator on data that comes
> from a source, it will calculate the average on all result values with
> the same set of parameters - reducing multiple data vectors to a single
> data vector. In contrast, wenn applying this operator to a data vector
> coming from an operator (an operator always emitts a single data
> vector), it will reduce this vector to a scalar.
>
> So, just place another avg operator between op.average and the output,
> and you should have what you want.

Thanks, that works, but IMHO it would be more intuitive if the average
operator would do the same automatically if applied to a single input.
After all, that is always a null-operation in the current design.

--
Best Regards

Patrick Ohly
Senior Software Engineer

Intel GmbH
Software & Solutions Group                
Hermuelheimer Strasse 8a                  Phone: +49-2232-2090-30
50321 Bruehl                              Fax: +49-2232-2090-29
Germany

Intel GmbH, Dornacher Strasse 1, 85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456
Ust.- IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: avg operator with just one input

by Joachim Worringen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Patrick Ohly schrieb:

> On Fri, 2007-03-16 at 12:42 +0100, Joachim Worringen wrote:
>> As you described, when you apply the avg operator on data that comes
>> from a source, it will calculate the average on all result values with
>> the same set of parameters - reducing multiple data vectors to a single
>> data vector. In contrast, wenn applying this operator to a data vector
>> coming from an operator (an operator always emitts a single data
>> vector), it will reduce this vector to a scalar.
>>
>> So, just place another avg operator between op.average and the output,
>> and you should have what you want.
>
> Thanks, that works, but IMHO it would be more intuitive if the average
> operator would do the same automatically if applied to a single input.
> After all, that is always a null-operation in the current design.

You never generally know in advance how many data sets with the same
parameter sets a <source> will create. Thus, the same operator may
deliver a vector and a scalar, depending on the data filtering you've
done for the <source>. I would rather call this confusing/unexpected
behaviour than intuitive - the current behaviour is consistent.

The different behaviour of an operator depending on getting its data
from a <source> or an other <operator> is something to be known. I think
I even covered it already in the ever-so-incomplete user manual... But
it's hard to understand until you've done it yourself.

  Joachim

--
Joachim Worringen, Software Architect, Dolphin Interconnect Solutions
phone ++49/(0)228/324 08 17 - http://www.dolphinics.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...