• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Histogram类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Histogram的典型用法代码示例。如果您正苦于以下问题:C# Histogram类的具体用法?C# Histogram怎么用?C# Histogram使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Histogram类属于命名空间,在下文中一共展示了Histogram类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: testGetEstimatedFootprintInBytes

        public void testGetEstimatedFootprintInBytes()  
        {
            Histogram histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
            /*
            *     largestValueWithSingleUnitResolution = 2 * (10 ^ numberOfSignificantValueDigits);
            *     subBucketSize = roundedUpToNearestPowerOf2(largestValueWithSingleUnitResolution);

            *     expectedHistogramFootprintInBytes = 512 +
            *          ({primitive type size} / 2) *
            *          (log2RoundedUp((highestTrackableValue) / subBucketSize) + 2) *
            *          subBucketSize
            */
            long largestValueWithSingleUnitResolution = 2 * (long) Math.Pow(10, numberOfSignificantValueDigits);
            int subBucketCountMagnitude = (int)Math.Ceiling(Math.Log(largestValueWithSingleUnitResolution) / Math.Log(2));
            int subBucketSize = (int) Math.Pow(2, (subBucketCountMagnitude));

            long expectedSize = 512 +
                    ((8 *
                     ((long)(
                            Math.Ceiling(
                             Math.Log(highestTrackableValue / subBucketSize)
                                     / Math.Log(2)
                            )
                           + 2)) *
                        (1 << (64 - MiscUtilities.numberOfLeadingZeros(2 * (long)Math.Pow(10, numberOfSignificantValueDigits))))
                     ) / 2);
            Assert.assertEquals(expectedSize, histogram.getEstimatedFootprintInBytes());
        }
开发者ID:elfchief,项目名称:HdrHistogram,代码行数:28,代码来源:HistogramTest.cs


示例2: HistogramDataAccessTest

        static HistogramDataAccessTest()
        {
            histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
            scaledHistogram = new Histogram(1000, highestTrackableValue * 512, numberOfSignificantValueDigits);
            rawHistogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
            scaledRawHistogram = new Histogram(1000, highestTrackableValue * 512, numberOfSignificantValueDigits);
            // Log hypothetical scenario: 100 seconds of "perfect" 1msec results, sampled
            // 100 times per second (10,000 results), followed by a 100 second pause with
            // a single (100 second) recorded result. Recording is done indicating an expected
            // interval between samples of 10 msec:
            for (int i = 0; i < 10000; i++) 
            {
                histogram.recordValueWithExpectedInterval(1000 /* 1 msec */, 10000 /* 10 msec expected interval */);
                scaledHistogram.recordValueWithExpectedInterval(1000 * 512 /* 1 msec */, 10000 * 512 /* 10 msec expected interval */);
                rawHistogram.recordValue(1000 /* 1 msec */);
                scaledRawHistogram.recordValue(1000 * 512/* 1 msec */);
            }
            histogram.recordValueWithExpectedInterval(100000000L /* 100 sec */, 10000 /* 10 msec expected interval */);
            scaledHistogram.recordValueWithExpectedInterval(100000000L * 512 /* 100 sec */, 10000 * 512 /* 10 msec expected interval */);
            rawHistogram.recordValue(100000000L /* 100 sec */);
            scaledRawHistogram.recordValue(100000000L * 512 /* 100 sec */);

            postCorrectedHistogram = rawHistogram.copyCorrectedForCoordinatedOmission(10000 /* 10 msec expected interval */);
            postCorrectedScaledHistogram = scaledRawHistogram.copyCorrectedForCoordinatedOmission(10000 * 512 /* 10 msec expected interval */);
        }
开发者ID:elfchief,项目名称:HdrHistogram,代码行数:25,代码来源:HistogramDataAccessTest.cs


示例3: Show

 /// <summary>
 /// Display the specific histogram
 /// </summary>
 /// <param name="hist">The histogram to be displayed</param>
 /// <param name="title">The name of the histogram</param>
 public static void Show(Histogram hist, string title)
 {
    HistogramViewer viewer = new HistogramViewer();
    viewer.HistogramCtrl.AddHistogram(title, Color.Black, hist);
    viewer.HistogramCtrl.Refresh();
    viewer.Show();
 }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:12,代码来源:HistogramViewer.cs


示例4: HistogramView

        /// <summary>
        ///   Constructs a new instance of the HistogramView.
        /// </summary>
        /// 
        public HistogramView()
        {
            InitializeComponent();

            this.histogram = new Histogram();
            graphBars = new ZedGraph.BarItem(String.Empty);
            graphBars.Color = Color.DarkBlue;
            zedGraphControl.GraphPane.Title.FontSpec.IsBold = true;
            zedGraphControl.GraphPane.Title.FontSpec.Size = 32f;
            zedGraphControl.GraphPane.Title.IsVisible = true;
            zedGraphControl.GraphPane.XAxis.Type = AxisType.Text;
            zedGraphControl.GraphPane.XAxis.Title.IsVisible = false;
            zedGraphControl.GraphPane.XAxis.MinSpace = 0;
            zedGraphControl.GraphPane.XAxis.MajorGrid.IsVisible = false;
            zedGraphControl.GraphPane.XAxis.MinorGrid.IsVisible = false;
            zedGraphControl.GraphPane.XAxis.MajorTic.IsBetweenLabels = true;
            zedGraphControl.GraphPane.XAxis.MajorTic.IsInside = false;
            zedGraphControl.GraphPane.XAxis.MajorTic.IsOpposite = false;
            zedGraphControl.GraphPane.XAxis.MinorTic.IsAllTics = false;
            zedGraphControl.GraphPane.XAxis.Scale.FontSpec.IsBold = true;
            zedGraphControl.GraphPane.XAxis.Scale.FontSpec.IsAntiAlias = true;
            zedGraphControl.GraphPane.YAxis.MinorTic.IsAllTics = false;
            zedGraphControl.GraphPane.YAxis.MajorTic.IsOpposite = false;
            zedGraphControl.GraphPane.YAxis.Title.Text = "Frequency";
            zedGraphControl.GraphPane.YAxis.Title.FontSpec.Size = 24f;
            zedGraphControl.GraphPane.YAxis.Title.FontSpec.IsBold = true;
            zedGraphControl.GraphPane.Border.IsVisible = false;
            zedGraphControl.GraphPane.BarSettings.MinBarGap = 0;
            zedGraphControl.GraphPane.BarSettings.MinClusterGap = 0;
            zedGraphControl.GraphPane.CurveList.Add(graphBars);
        }
开发者ID:KommuSoft,项目名称:accord_framework,代码行数:35,代码来源:HistogramView.cs


示例5: run

    internal static ArrayList run(IList para)
    {
        bool reverse = false;
        modshogun.init_shogun_with_defaults();
        int order = (int)((int?)para[0]);
        int gap = (int)((int?)para[1]);

        string[] fm_train_dna = Load.load_dna("../data/fm_train_dna.dat");

        StringCharFeatures charfeat = new StringCharFeatures(fm_train_dna, DNA);
        StringWordFeatures feats = new StringWordFeatures(charfeat.get_alphabet());
        feats.obtain_from_char(charfeat, order-1, order, gap, reverse);

        Histogram histo = new Histogram(feats);
        histo.train();

        histo.get_histogram();

        int num_examples = feats.get_num_vectors();
        int num_param = histo.get_num_model_parameters();

        DoubleMatrix out_likelihood = histo.get_log_likelihood();
        double out_sample = histo.get_log_likelihood_sample();

        ArrayList result = new ArrayList();
        result.Add(histo);
        result.Add(out_sample);
        result.Add(out_likelihood);
        modshogun.exit_shogun();
        return result;
    }
开发者ID:orico,项目名称:shogun,代码行数:31,代码来源:distribution_histogram_modular.cs


示例6: Evaluate_NormalSample

        public void Evaluate_NormalSample()
        {
            var sample = Enumerable
                .Range(1, 10)
                .Select(n => new { p = Functions.NormalDistribution(n, 2.87f, 5), n = n })
                .SelectMany(x => Enumerable.Range(1, (int)(x.p * 100)).Select(n => (x.n).OutOf(10)))
                .ToList()
                .AsQueryable();

            var hist = new Histogram(0.02f);
            var kde = new KernelDensityEstimator(0.02f);
            var histF = hist.Evaluate(sample);
            var kdeF = kde.Evaluate(sample);
            var stdDevMu = Functions.MeanStdDev(sample);

            Console.WriteLine("Mean\t{0}", stdDevMu.Item1);
            Console.WriteLine("StdDev\t{0}", stdDevMu.Item2);

            var hRes = Enumerable.Range(1, 10).Select(n => new { n = n, p = histF(n.OutOf(10)) });
            var kRes = Enumerable.Range(1, 10).Select(n => kdeF(n.OutOf(10))).Normalise().ToList();
            int i = 0;

            foreach (var x in hRes)
            {
                var kr = kRes[i++];
                Console.WriteLine("{0}\t{1}\t{2}", x.n, x.p.Value, kr.Value);
                Assert.That(Math.Round(x.p.Value, 4), Is.EqualTo(Math.Round(kr.Value, 4)));
            }
        }
开发者ID:roberino,项目名称:linqinfer,代码行数:29,代码来源:HistogramTests.cs


示例7: PermutationDistribution

        public void PermutationDistribution()
        {
            // We want to test that GetRandomPermutation actually samples all permutations equally

            // Don't let n get too big or we will have a ridiculously large number of bins
            for (int n = 2; n < 8; n++) {

                // Build a mapping that assign each permutation a unique integer index from 0 to (n! - 1)
                Dictionary<Permutation, int> index = new Dictionary<Permutation, int>();
                int count = 0;
                foreach (Permutation p in Permutation.Permutations(n)) {
                    index.Add(p, count);
                    count++;
                }

                // Create a historgram of randomly generated permutation indexes
                Histogram histogram = new Histogram(count);
                Random rng = new Random(2);
                for (int i = 0; i < 8 * count; i++) {
                    Permutation p = Permutation.GetRandomPermutation(n, rng);
                    histogram.Bins[index[p]].Increment();
                }

                //for (int i = 0; i < count; i++) {
                //    Console.WriteLine("{0} {1}", i, bins[i].Counts);
                //}

                TestResult result = histogram.ChiSquaredTest(new DiscreteUniformDistribution(0, count - 1));
                Console.WriteLine(result.RightProbability);
                Assert.IsTrue(result.RightProbability > 0.01);

            }
        }
开发者ID:JackDetrick,项目名称:metanumerics,代码行数:33,代码来源:PermutationTest.cs


示例8: Analyse_TimeSeries

        public void Analyse_TimeSeries()
        {
            var now = DateTime.UtcNow;
            var now_plusx = new Func<int, DateTime>(x => now.AddHours(x));
            var width = TimeSpan.FromHours(1);
            var hist = new Histogram(width.TotalMilliseconds);

            var sample = new[] {
                new { date = now, name = "a" },
                new { date = now_plusx(1), name = "b" },
                new { date = now_plusx(1), name = "c" },
                new { date = now_plusx(3), name = "d" },
                new { date = now_plusx(4), name = "e" },
                new { date = now_plusx(6), name = "f" },
                new { date = now_plusx(6), name = "g" },
                new { date = now_plusx(8), name = "h" }
            }.AsQueryable();

            var histSample = hist.Analyse(sample, v => v.date);
            
            Assert.That(histSample.Min, Is.EqualTo(now));
            Assert.That(histSample.Max, Is.EqualTo(now_plusx(8)));
            Assert.That(histSample.Total, Is.EqualTo(sample.Count()));
            Assert.That(histSample.Width, Is.EqualTo(width));
            Assert.That(histSample.Bins.Count, Is.EqualTo(9));
            Assert.That(histSample.Bins[0], Is.EqualTo(1));
            Assert.That(histSample.Bins[1], Is.EqualTo(2));
            Assert.That(histSample.Bins[6], Is.EqualTo(2));
        }
开发者ID:roberino,项目名称:linqinfer,代码行数:29,代码来源:HistogramTests.cs


示例9: Hystogram_Dump_1

        public void Hystogram_Dump_1()
        {
            const int CNT = 100000;
              const int MAX_RND = 100;

              var hist = new Histogram<int>("Random Histogram",
                new Dimension<int>(
                    "ValBucket",
                    partCount: MAX_RND,
                    partitionFunc: (dim, v) => {
                        return v;// % 100;
                    },
                    partitionNameFunc: (i) => i.ToString()
                )
            );

             // var rnd = new Random();
              for(var i=0; i<CNT; i++)
              {
             //   var r = rnd.Next(100);// ExternalRandomGenerator.Instance.NextScaledRandomInteger(0,100);
            var r = ExternalRandomGenerator.Instance.NextScaledRandomInteger(0, MAX_RND);
            hist.Sample( r );
             //   ExternalRandomGenerator.Instance.FeedExternalEntropySample( (int)NFX.OS.Computer.GetMemoryStatus().AvailablePhysicalBytes);
              }

              string output = hist.ToStringReport();
              Console.WriteLine( output );

              var countPerRandomSeed = CNT / (double)MAX_RND;
              var tolerance = countPerRandomSeed * 0.15d;//Guarantees uniform random distribution. The lower the number, the more uniform gets
              foreach(var he in hist)
               Assert.IsTrue( he.Count >countPerRandomSeed-tolerance && he.Count < countPerRandomSeed+tolerance);
        }
开发者ID:itadapter,项目名称:nfx,代码行数:33,代码来源:ExtRndGenTests.cs


示例10: Main

	public static void Main() {
		bool reverse = false;
		modshogun.init_shogun_with_defaults();
		int order = 3;
		int gap = 4;

		String[] fm_train_dna = Load.load_dna("../data/fm_train_dna.dat");

		StringCharFeatures charfeat = new StringCharFeatures(fm_train_dna, EAlphabet.DNA);
		StringWordFeatures feats = new StringWordFeatures(charfeat.get_alphabet());
		feats.obtain_from_char(charfeat, order-1, order, gap, reverse);

		Histogram histo = new Histogram(feats);
		histo.train();

		double[] histogram = histo.get_histogram();

		foreach(double item in histogram) {
			Console.Write(item);
		}
		//int  num_examples = feats.get_num_vectors();
		//int num_param = histo.get_num_model_parameters();

		//double[,] out_likelihood = histo.get_log_likelihood();
		//double out_sample = histo.get_log_likelihood_sample();

		modshogun.exit_shogun();
	}
开发者ID:Anshul-Bansal,项目名称:gsoc,代码行数:28,代码来源:distribution_histogram_modular.cs


示例11: AddHistogram

      /// <summary>
      /// Add a plot of the 1D histogram. You should call the Refresh() function to update the control after all modification is complete.
      /// </summary>
      /// <param name="name">The name of the histogram</param>
      /// <param name="color">The drawing color</param>
      /// <param name="histogram">The 1D histogram to be drawn</param>
      public void AddHistogram(String name, System.Drawing.Color color, Histogram histogram)
      {
         Debug.Assert(histogram.Dimension == 1, "Only 1D histogram is supported");

         GraphPane pane = new GraphPane();
         // Set the Title
         pane.Title.Text = name;
         pane.XAxis.Title.Text = "Color Intensity";
         pane.YAxis.Title.Text = "Pixel Count";

         #region draw the histogram
         RangeF range = histogram.Ranges[0];
         int binSize = histogram.BinDimension[0].Size;
         float step = (range.Max - range.Min) / binSize;
         float start = range.Min;
         double[] bin = new double[binSize];
         for (int binIndex = 0; binIndex < binSize; binIndex++)
         {
            bin[binIndex] = start;
            start += step;
         }

         PointPairList pointList = new PointPairList(
            bin,
            Array.ConvertAll<float, double>(histogram.Data, System.Convert.ToDouble));

         pane.AddCurve(name, pointList, color);
         #endregion

         zedGraphControl1.MasterPane.Add(pane);
      }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:37,代码来源:HistogramCtrl.cs


示例12: AssertBinCounts

 private static void AssertBinCounts(Histogram histogram, int[] counts)
 {
     Assert.IsTrue(histogram.BelowRangeBin.Counts == counts[0]);
     for (int i = 0; i < histogram.Bins.Count; i++) {
         Assert.IsTrue(histogram.Bins[i].Counts == counts[i + 1]);
     }
     Assert.IsTrue(histogram.AboveRangeBin.Counts == counts[histogram.Bins.Count + 1]);
 }
开发者ID:JackDetrick,项目名称:metanumerics,代码行数:8,代码来源:HistogramTest.cs


示例13: Metric

 protected Metric(double mean, double min, double max, long count, double accumulatedVariance, Histogram histogram)
 {
     Mean = mean;
     Min = min;
     Max = max;
     Count = count;
     this.accumulatedVariance = accumulatedVariance;
     Histogram = histogram;
 }
开发者ID:lovewitty,项目名称:OstrichNet,代码行数:9,代码来源:Metric.cs


示例14: testConstructionArgumentGets

 public void testConstructionArgumentGets()  
 {
     Histogram histogram = new Histogram(highestTrackableValue, numberOfSignificantValueDigits);
     Assert.assertEquals(1, histogram.getLowestTrackableValue());
     Assert.assertEquals(highestTrackableValue, histogram.getHighestTrackableValue());
     Assert.assertEquals(numberOfSignificantValueDigits, histogram.getNumberOfSignificantValueDigits());
     Histogram histogram2 = new Histogram(1000, highestTrackableValue, numberOfSignificantValueDigits);
     Assert.assertEquals(1000, histogram2.getLowestTrackableValue());
 }
开发者ID:elfchief,项目名称:HdrHistogram,代码行数:9,代码来源:HistogramTest.cs


示例15: CorrelationScoreTable

        public CorrelationScoreTable(ScoreMethod method, int intensityBins, double[] binEdges)
        {
            _method = method;
            _binEdges = binEdges;
            IntensityBins = null;
            _intensityBinCount = intensityBins;
            WorstScore = new Probability<int>(0);

            _intensityHistogram = new Histogram<FitScore>(new CompareFitScoreByIntensity());
        }
开发者ID:javamng,项目名称:GitHUB,代码行数:10,代码来源:CorrelationScoreTable.cs


示例16: TimeHistogram

 public TimeHistogram(
     string title,
     string dim1Name,
     int    dim1PartCount,
     PartitionFunc<double>   dim1PartitionFunc = null,
     PartitionNameFunc       dim1PartitionNameFunc = null)
 {
     m_Hist = new Histogram<double>(title,
         new TimeDimension(
             dim1Name, dim1PartCount, dim1PartitionFunc, dim1PartitionNameFunc));
 }
开发者ID:itadapter,项目名称:nfx,代码行数:11,代码来源:TimeHistogram1.cs


示例17: CanCreateMultinomialFromHistogram

        public void CanCreateMultinomialFromHistogram()
        {
            double[] smallDataset = { 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5 };
            var hist = new Histogram(smallDataset, 10, 0.0, 10.0);
            var m = new Multinomial(hist, 7);

            foreach (var t in m.P)
            {
                Assert.AreEqual(1.0, t);
            }
        }
开发者ID:jvangael,项目名称:mathnet-numerics,代码行数:11,代码来源:MultinomialTests.cs


示例18: CanCreateCategoricalFromHistogram

        public void CanCreateCategoricalFromHistogram()
        {
            double[] smallDataset = { 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5 };
            Histogram hist = new Histogram(smallDataset, 10, 0.0, 10.0);
            var m = new Categorical(hist);

            for (int i = 0; i <= m.Maximum; i++)
            {
                AssertEx.AreEqual<double>(1.0/10.0, m.P[i]);
            }
        }
开发者ID:hany-abdelrahman,项目名称:mathnet-numerics,代码行数:11,代码来源:CategoricalTests.cs


示例19: OnEnable

		void OnEnable()
		{
			p_CurrentChannel = serializedObject.FindProperty("e_CurrentChannel");
			p_Logarithmic = serializedObject.FindProperty("e_Logarithmic");
			p_AutoRefresh = serializedObject.FindProperty("e_AutoRefresh");

			m_Target = target as Histogram;
			m_Target.e_OnFrameEnd = UpdateHistogram;
			m_Target.InternalForceRefresh();

			InternalEditorUtility.RepaintAllViews();
		}
开发者ID:pryd0008,项目名称:GGJ2016,代码行数:12,代码来源:HistogramEditor.cs


示例20: Save

 public void Save(string v, Histogram histogram, bool shouldCompress = false)
 {
     stage.Unlock(true);
     if (shouldCompress)
     {
         Image quantized = quantizer.QuantizeImage(bmp, 128, 0, histogram, 128);
         quantized.Save(v, System.Drawing.Imaging.ImageFormat.Png);
     } else
     {
         bmp.Save(v, System.Drawing.Imaging.ImageFormat.Png);
     }
 }
开发者ID:Decagon,项目名称:Squirrel,代码行数:12,代码来源:Minimap.cs



注:本文中的Histogram类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# History类代码示例发布时间:2022-05-24
下一篇:
C# HiscoreData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap