that is, sum the weights of the ground lines, then multiply by the weights in the response line, then add to the weights of the response line multiplied with itself, then square or log the result.
$$\matrix{
A & B & C \
.2 & 0 & 0 \
.2 & 0 & 0 \
.3 & .1 & 0
}$$
Here, we'd sum the ground lines, giving $p_A = .4$, so we'd get
$\theta{AA} = .3 \times .4 = .12$, $\sqrt{\theta{AA}} \approx .35$ (note, we don't count the $.3$ on the last line as connecting to itself, so we do not have $.3 \times .3$ as a term)
this can be implemented by keeping a running sum of the conversation weights that, at the end of each line loop:
adds the current response line to the running ground total
accesses the row windowSize or so back by index (the row that is falling out of the window as this new line enters), and subtracts that row from the running ground total
This lets us handle things in linear time, assuming index look-up is constant time in DataFrames
Weighted models are calculated as
that is, sum the weights of the ground lines, then multiply by the weights in the response line, then add to the weights of the response line multiplied with itself, then square or log the result.
$$\matrix{ A & B & C \ .2 & 0 & 0 \ .2 & 0 & 0 \ .3 & .1 & 0 }$$
Here, we'd sum the ground lines, giving $p_A = .4$, so we'd get
this can be implemented by keeping a running sum of the conversation weights that, at the end of each line loop:
windowSize
or so back by index (the row that is falling out of the window as this new line enters), and subtracts that row from the running ground totalThis lets us handle things in linear time, assuming index look-up is constant time in
DataFrames