class_docstr: Provide test coverage when using provided estimators for optimal number of
  bins
class_docstr_tok: ["Provide","test","coverage","when","using","provided","estimators","for","optimal","number","of","bins"]
docstr: Verify that Scott's rule and Stone's rule converges for normally distributed data
docstr_tok: ["Verify","that","Scott","'s","rule","and","Stone","'s","rule","converges","for","normally","distributed","data"]
code: def test_scott_vs_stone(self):
      """Verify that Scott's rule and Stone's rule converges for normally distributed data"""
  
      def nbins_ratio(seed, size):
          rng = np.random.RandomState(seed)
          x = rng.normal(loc=0, scale=2, size=size)
          a, b = len(np.histogram(x, "stone")[0]), len(
              np.histogram(x, "scott")[0]
          )
          return a / (a + b)
  
      ll = [
          [
              nbins_ratio(seed, size)
              for size in np.geomspace(start=10, stop=100, num=4)
              .round()
              .astype(int)
          ]
          for seed in range(10)
      ]
  
      # the average difference between the two methods decreases as the dataset size increases.
      avg = abs(np.mean(ll, axis=0) - 0.5)
      assert_almost_equal(avg, [0.15, 0.09, 0.08, 0.03], decimal=2)
  
imports: import functools
  from unittest import expectedFailure, skipIf
  from pytest import raises
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, slowTest, TEST_WITH_TORCHDYNAMO, TestCase, xpassIfTorchDynamo
label_desc: Use image node_id 8 for calling the TestHistogramOptimBinNums obj's underlying member method code with example usage: obj.test_scott_vs_stone() and returns: unknown