Class ActivityIndex
Old formula for activity index was not linear and difficult to turn into a query due to conditional multipliers. Thus a new formula was written.
T
- Time played after someone is considered active on a particular week
t1, t2, t3
- Time played that week
Activity index takes into account last 3 weeks.
Activity for a single week is calculated using A(t) = (1 / (pi/2 * (t/T) + 1))
.
A(t) is based on function f(x) = 1 / (x + 1), which has property f(0) = 1, decreasing from there, but not in a straight line.
You can see the function plotted here https://www.wolframalpha.com/input/?i=1+%2F+(x%2B1)+from+-1+to+2
To fine tune the curve pi/2 is used since it felt like a good curve.
Activity index A is calculated by using the formula:
A = 5 - 5 * [A(t1) + A(t2) + A(t3)] / 3
Plot for A and limits https://www.wolframalpha.com/input/?i=plot+y+%3D+5+-+5+*+(1+%2F+(pi%2F2+*+x%2B1))+and+y+%3D1+and+y+%3D+2+and+y+%3D+3+and+y+%3D+3.75+from+-0.5+to+3
New Limits for A would thus be
< 1: Inactive
> 1: Irregular
> 2: Regular
> 3: Active
> 3.75: Very Active
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
static final double
static final double
static final double
-
Constructor Summary
ConstructorDescriptionActivityIndex
(double value, long date) ActivityIndex
(DataContainer container, long date, long playtimeMsThreshold) ActivityIndex
(List<FinishedSession> sessions, long date, long playtimeMsThreshold) -
Method Summary
Modifier and TypeMethodDescriptiondouble
distance
(ActivityIndex other) long
getDate()
static String[]
getFormattedValue
(Formatter<Double> formatter) getGroup()
static String
getGroup
(double value) static HtmlLang
getGroupLang
(double value) static String[]
double
getValue()
-
Field Details
-
VERY_ACTIVE
public static final double VERY_ACTIVE- See Also:
-
ACTIVE
public static final double ACTIVE- See Also:
-
REGULAR
public static final double REGULAR- See Also:
-
IRREGULAR
public static final double IRREGULAR- See Also:
-
-
Constructor Details
-
ActivityIndex
-
ActivityIndex
-
ActivityIndex
public ActivityIndex(double value, long date)
-
-
Method Details
-
getDefaultGroups
-
getGroups
-
getValue
public double getValue() -
getDate
public long getDate() -
getFormattedValue
-
distance
-
getGroupLang
-
getGroup
-
getGroup
-
getGroupLang
-
getGroup
-