mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
fix bug in mann whitney u test
This commit is contained in:
parent
008d02880b
commit
2c8fade3d7
@ -114,7 +114,7 @@ private:
|
||||
{
|
||||
if (ind < first.size())
|
||||
return first[ind];
|
||||
return second[ind % first.size()];
|
||||
return second[ind - first.size()];
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
|
@ -17,9 +17,20 @@ def test_and_check(name, a, b, t_stat, p_value):
|
||||
client.query(
|
||||
"CREATE TABLE mann_whitney (left Float64, right UInt8) ENGINE = Memory;"
|
||||
)
|
||||
#client.query(
|
||||
# "INSERT INTO mann_whitney VALUES {};".format(
|
||||
# ", ".join(["({},{}), ({},{})".format(i, 0, j, 1) for i, j in zip(a, b)])
|
||||
# )
|
||||
#)
|
||||
client.query(
|
||||
"INSERT INTO mann_whitney VALUES {};".format(
|
||||
", ".join(["({},{}), ({},{})".format(i, 0, j, 1) for i, j in zip(a, b)])
|
||||
", ".join(["({},{})".format(i, 0) for i in a])
|
||||
)
|
||||
)
|
||||
|
||||
client.query(
|
||||
"INSERT INTO mann_whitney VALUES {};".format(
|
||||
", ".join(["({},{})".format(i, 1) for i in b])
|
||||
)
|
||||
)
|
||||
|
||||
@ -59,6 +70,15 @@ def test_mann_whitney():
|
||||
test_and_check("mannWhitneyUTest('greater')", rvs1, rvs2, s, p)
|
||||
|
||||
|
||||
def test_mann_whitney_skew():
|
||||
rvs1 = [1]
|
||||
rvs2 = [0,2,4]
|
||||
s, p = stats.mannwhitneyu(rvs1, rvs2, alternative="two-sided")
|
||||
test_and_check("mannWhitneyUTest", rvs1, rvs2, s, p)
|
||||
test_and_check("mannWhitneyUTest('two-sided')", rvs1, rvs2, s, p)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_mann_whitney()
|
||||
test_mann_whitney_skew()
|
||||
print("Ok.")
|
||||
|
Loading…
Reference in New Issue
Block a user