Constructor
new KernelDensityEstimation(time_rotate, past_data)
- Source:
Properties:
Name | Type | Description |
---|---|---|
index_li |
Array.<number> | Indexing array of [0,1,...,80] ( |
x_li |
Array.<number> | Array defining the locations of the histogram bins around the clock. It is the index_li
mapped into discrete seconds between [−T/2, T/2] where T is the rotation period. For example, if |
dens_li |
Array.<number> | Array containing the current histogram, represented as a list of length 80 where each value is the 'height' for that bin. |
Z |
number | The sum of the |
y_li |
Array.<number> | Array of timestamps for the most recent click times fed into the KDE. |
y_ksigma |
Array.<number> | Array of the optimal bandwidths used up until so far; |
damp |
number | The dampening factor used to weight more recent click times more heavily (default = 0.96). |
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
time_rotate |
number | The rotation period in seconds of the clocks. |
|||||||||||||||
past_data |
Object | null | Object containing previous data from the KDE from the prior session, if no past data then null. Properties
|
Methods
ave_sigma_sq(eff_num_points, yLenEff) → {number}
- Description:
Helper function for calculating the optimal bandwidth.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
eff_num_points |
||
yLenEff |
Returns:
- Type
- number
calc_ksigma(eff_num_points, yLenEff) → {number}
- Description:
Returns the optimal bandwidth for kernel density estimation. When overlapping normal distributions centered around each sample, the optimal bandwidth w is given by w = 1.06σN^(−1/5), where N is the number of samples and σ is the standard deviation of the samples.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
eff_num_points |
||
yLenEff |
Returns:
- Type
- number
increment_dens(yin, ksigma)
- Description:
When a new yin (relative click-time) comes in, include that new point in Kernel density estimation.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
yin |
number | The new relative click-time in seconds. |
ksigma |
number | The new calculated optimal bandwidth. |
initialize_dens()
- Description:
Initializes the KDE with the past data, if available, or uses an initial normal distribution.
- Source: