prio-data / views_transformation_library

The data transformation library used by the views data transformer service
Other
1 stars 1 forks source link

Decay #6

Closed Peder2911 closed 3 years ago

Peder2911 commented 3 years ago

A decay transform is based on a time-since transform, where each value decreases according to a half-life function:

0,1,2,3,4
0,1,0.50,0.25,0.125

Is this useful @hhegre? I was asked to do one of these when working as an RA for Håvard N. @ PRIO, but these might not be widely used / useful for modelling?

hhegre commented 3 years ago

We use this all the time in ViEWS. They are more practical than the counts, even when using flexible algorithms such as gams and random forests.

We have to be able to pass the half-life parameter alpha in f(t) = 2ˆ(-t/alpha)

H

On 11 Mar 2021, at 13:20, Peder G. Landsverk @.**@.>> wrote:

A decay transform is based on a time-since transform, where each value decreases according to a half-life function:

0,1,2,3,4

0,1,0.50,0.25,0.125

Is this useful @hhegrehttps://github.com/hhegre? I was asked to do one of these when working as an RA for Håvard N. @ PRIO, but these might not be widely used / useful for modelling?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/prio-data/views-transformation-library/issues/6, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACW6H5CLZZGR7NPKEAHQWK3TDCYPHANCNFSM4ZAFQLRA.

Håvard Hegre Dag Hammarskjöld Professor of Peace and Conflict Research, Uppsala University Project director, ViEWS: http://views.pcr.uu.se Box 514, SE 751 20 Uppsala, Sweden Research Professor at Peace Research Institute Oslo Email: @.*** Twitter: @HavardHegre


När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy

Peder2911 commented 3 years ago

Absolutely! I implemented this in R in 2020 (seems like ages ago now) as

halflife <- function(t, init = 1){
   function(x){
      init * (0.5 ^ (x * (1/t)))
   }
}
Peder2911 commented 3 years ago

Implemented in ViEWS 2 and added in 308cc99a