Linux-bcachefs Archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Brian Foster <bfoster@redhat.com>,
	linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mean and variance: More tests
Date: Mon, 19 Feb 2024 15:31:04 -0800	[thread overview]
Message-ID: <065b94eb-6a24-4248-b7d7-d3212efb4787@roeck-us.net> (raw)

Hi,

On Thu, May 25, 2023 at 10:22:25PM -0400, Kent Overstreet wrote:
> Add some more tests that test conventional and weighted mean
> simultaneously, and with a table of values that represents events that
> we'll be using this to look for so we can verify-by-eyeball that the
> output looks sane.

[...]

> +/* Test behaviour with a single outlier, then back to steady state: */
> +static void mean_and_variance_test_1(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 10, 10, 10, 10, 10, 10 };
> +	s64 mean[]		= {  22, 21, 20, 19, 18, 17, 16 };
> +	s64 stddev[]		= {  32, 29, 28, 27, 26, 25, 24 };
> +	s64 weighted_mean[]	= {  32, 27, 22, 19, 17, 15, 14 };
> +	s64 weighted_stddev[]	= {  38, 35, 31, 27, 24, 21, 18 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
> +}
> +
> +static void mean_and_variance_test_2(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 10, 10, 10, 10, 10, 10 };
> +	s64 mean[]		= {  10, 10, 10, 10, 10, 10, 10 };
> +	s64 stddev[]		= {   9,  9,  9,  9,  9,  9,  9 };
> +	s64 weighted_mean[]	= {  32, 27, 22, 19, 17, 15, 14 };
> +	s64 weighted_stddev[]	= {  38, 35, 31, 27, 24, 21, 18 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
> +}
> +
> +/* Test behaviour where we switch from one steady state to another: */
> +static void mean_and_variance_test_3(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 100, 100, 100, 100 };
> +	s64 mean[]		= {  22,  32,  40,  46,  50 };
> +	s64 stddev[]		= {  32,  39,  42,  44,  45 };
> +	s64 weighted_mean[]	= {  32,  49,  61,  71,  78 };
> +	s64 weighted_stddev[]	= {  38,  44,  44,  41,  38 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
> +}
> +
> +static void mean_and_variance_test_4(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 100, 100, 100, 100 };
> +	s64 mean[]		= {  10,  11,  12,  13,  14 };
> +	s64 stddev[]		= {   9,  13,  15,  17,  19 };
> +	s64 weighted_mean[]	= {  32,  49,  61,  71,  78 };
> +	s64 weighted_stddev[]	= {  38,  44,  44,  41,  38 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
>  }

Tests 2 and 4 fail for me, and I fail to see how they could ever pass,
given that the input parameters of test 2 are identical to those of test 1,
and the input parameters of test 4 are identical to those of test 3,
but the expected results for mean[] and stddev[] tests are different.

What am I missing ?

Thanks,
Guenter

                 reply	other threads:[~2024-02-19 23:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=065b94eb-6a24-4248-b7d7-d3212efb4787@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bfoster@redhat.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).