Hi Malith,

Yes, I agree with your point. We can input set of percentiles at once. But
if we want to do that this cannot be implemented as aggregate function
extension since there will be multiple outputs as well. Therefore, we might
have to implement this as a stream processor extension such as regression
extension[1]. But a function like regression, that would be fine since it
has multiple outputs such as standard error, β coefficients etc. But
percentile is a simple aggregate function such as avg, median, max etc.
Therefore, it will be more complicated if we go for such implementation
IMO. Also in a practical situation hope, we might not need lots of
percentiles at once. Therefore, if we need two or three percentiles as you
said, we can simply call the percentile function again and send the outputs
to the same stream IMO.

[1]https://docs.wso2.com/display/CEP400/Regression

Thanks,
Ashen


On Fri, Jun 10, 2016 at 9:05 AM, Malith Jayasinghe <[email protected]> wrote:

> +1 for implementing percentiles. There are cases where have to deal with
> more than one percentile value (e.g. 90% and 95%). What is the best way to
> handle case? Can we have an implementation where we can pass an array
> (containing percentiles)  and get the function to return an array of
> percentile values? Or would it make more sense to call the function which
> accepts a single percentile multiple times?
>
> On Thu, Jun 9, 2016 at 1:57 PM, Seshika Fernando <[email protected]> wrote:
>
>> Ah yes. That would work. :)
>>
>> On Thu, Jun 9, 2016 at 10:07 AM, Ashen Weerathunga <[email protected]>
>> wrote:
>>
>>> @Suho,
>>> sure, I'll handle that.
>>>
>>> @Seshi,
>>> I'm writing this as an Aggregate Function Extension. Therefore, it will
>>> be supported for all the window types that currently supports for aggregate
>>> functions such as avg, min, max etc. As an example, we can write a query as
>>> below,
>>>
>>> *from inputStream#window.lengthBatch(100)*
>>> *select math:percentile(temperature, 97.0) as percentile*
>>> *insert into outputStream;*
>>>
>>> Above query will return the 97th percentile value of last 100 events of
>>> temperature variable.
>>>
>>> Likewise, we can use other windows such as timeBatch, cron etc as for
>>> the requirement. Would that approach be OK with this?
>>>
>>> Thanks,
>>> Ashen
>>>
>>> On Thu, Jun 9, 2016 at 5:18 AM, Seshika Fernando <[email protected]>
>>> wrote:
>>>
>>>> Ashen,
>>>> Is there no way that we can provide a window for temperature field?
>>>> Practically, we may want to know the 97th percentile of the last n events.
>>>> In that case how would I use this extension? It might be a good idea to
>>>> allow user to provide an interval based on length and/or time (like we do
>>>> for regression)
>>>>
>>>> On 9 Jun 2016 01:54, "Sriskandarajah Suhothayan" <[email protected]> wrote:
>>>> >
>>>> > Since p can't change during the execution, make sure to force p to be
>>>> a constant value.
>>>> > Am I correct here ?
>>>>
>>>> +1. Yes, it should be constant.
>>>>
>>>> >
>>>> > Regards
>>>> > Suho
>>>> >
>>>> > On Wed, Jun 8, 2016 at 6:38 AM, Ashen Weerathunga <[email protected]>
>>>> wrote:
>>>> >>
>>>> >> Hi All,
>>>> >>
>>>> >> I'm writing a siddhi extension for calculating percentile values.
>>>> This will be implemented as an Aggregate Function Extension under math
>>>> extensions. Two input parameter will be required for this function as 
>>>> below:
>>>> >>
>>>> >> <double> percentile(<int|long|double|float> arg, <double> p)
>>>> >> arg : values that need to be considered when calculating the
>>>> percentile value
>>>> >> p : percentile
>>>> >> This will return an estimate for pth percentile of arg values.
>>>> >> eg : percentile(temperature, 95.0)
>>>> >> returns the 95th percentile value of all the temperature events
>>>> based on their arrival and expiry.
>>>> >> Please let me know if you have any suggestions on this.
>>>> >>
>>>> >> Thanks,
>>>> >> Ashen
>>>> >>
>>>> >> --
>>>> >> Ashen Weerathunga
>>>> >> Software Engineer
>>>> >> WSO2 Inc.: http://wso2.com
>>>> >> lean.enterprise.middleware
>>>> >>
>>>> >> Email: [email protected]
>>>> >> Mobile: +94 716042995
>>>> >> LinkedIn: http://lk.linkedin.com/in/ashenweerathunga
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> > S. Suhothayan
>>>> > Technical Lead & Team Lead of WSO2 Complex Event Processor
>>>> > WSO2 Inc. http://wso2.com
>>>> > lean . enterprise . middleware
>>>> >
>>>> > cell: (+94) 779 756 757 | blog: http://suhothayan.blogspot.com/
>>>> > twitter: http://twitter.com/suhothayan | linked-in:
>>>> http://lk.linkedin.com/in/suhothayan
>>>> >
>>>> > _______________________________________________
>>>> > Architecture mailing list
>>>> > [email protected]
>>>> > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>> >
>>>>
>>>>
>>>
>>>
>>> --
>>> *Ashen Weerathunga*
>>> Software Engineer
>>> WSO2 Inc.: http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> Email: [email protected]
>>> Mobile: +94 716042995 <94716042995>
>>> LinkedIn: *http://lk.linkedin.com/in/ashenweerathunga
>>> <http://lk.linkedin.com/in/ashenweerathunga>*
>>>
>>
>>
>> _______________________________________________
>> Architecture mailing list
>> [email protected]
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>
>>
>
>
> --
> Malith Jayasinghe
>
>
> WSO2, Inc. (http://wso2.com)
> Email   : [email protected]
> Mobile : 0770704040
> Lean . Enterprise . Middleware
>



-- 
*Ashen Weerathunga*
Software Engineer
WSO2 Inc.: http://wso2.com
lean.enterprise.middleware

Email: [email protected]
Mobile: +94 716042995 <94716042995>
LinkedIn: *http://lk.linkedin.com/in/ashenweerathunga
<http://lk.linkedin.com/in/ashenweerathunga>*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to