Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
eurekaka committed Feb 23, 2019
1 parent a1fd0ae commit e8ec929
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion statistics/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ func BuildColumn(ctx sessionctx.Context, numBuckets, id int64, collector *Sample
// (sampleNum-1)*sampleNum / 2
// and sum(X^2) = sum(Y^2) =
// (sampleNum-1)*sampleNum*(2*sampleNum-1) / 6
// The formula for computing correlation is borrowed from PostgreSQL.
// We use "Pearson correlation coefficient" to compute the order correlation of columns,
// the formula is based on https://en.wikipedia.org/wiki/Pearson_correlation_coefficient.
// Note that (itemsCount*corrX2Sum - corrXSum*corrXSum) would never be zero when sampleNum is larger than 1.
itemsCount := float64(sampleNum)
corrXSum := (itemsCount - 1) * itemsCount / 2.0
Expand Down

0 comments on commit e8ec929

Please sign in to comment.