当前位置: 首页>>代码示例>>C#>>正文


C# Beta.Sample方法代码示例

本文整理汇总了C#中Beta.Sample方法的典型用法代码示例。如果您正苦于以下问题:C# Beta.Sample方法的具体用法?C# Beta.Sample怎么用?C# Beta.Sample使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Beta的用法示例。


在下文中一共展示了Beta.Sample方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DinaSample

		// Sample data from the DINA model
		public static bool[][] DinaSample(int nStudents, int nSkills, int[][] skillsRequired, Beta slipPrior, Beta guessPrior, 
			out double[] pSkillOut, out double[] slip, out double[] guess, out bool[][] hasSkill)
		{
			int nQuestions = skillsRequired.Length;
			double[] pSkill = Util.ArrayInit(nSkills, q => Rand.Double());
			slip = Util.ArrayInit(nQuestions, q => slipPrior.Sample());
			guess = Util.ArrayInit(nQuestions, q => guessPrior.Sample());
			hasSkill = Util.ArrayInit(nStudents, t => Util.ArrayInit(nSkills, s => Rand.Double() < pSkill[s]));
			bool[][] responses = new bool[nStudents][];
			for (int t = 0; t < nStudents; t++) {
				responses[t] = new bool[nQuestions];
				for (int q = 0; q < nQuestions; q++) {
					bool hasAllSkills = Factor.AllTrue(Factor.Subarray(hasSkill[t], skillsRequired[q]));
					if (hasAllSkills) responses[t][q] = (Rand.Double() > slip[q]);
					else responses[t][q] = (Rand.Double() < guess[q]);
				}
			}
			pSkillOut = pSkill;
			return responses;
		}
开发者ID:xornand,项目名称:Infer.Net,代码行数:21,代码来源:StudentSkills.cs

示例2: CanSample

 public void CanSample()
 {
     var n = new Beta(2.0, 3.0);
     n.Sample();
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:5,代码来源:BetaTests.cs

示例3: NidaSample

		// Sample data from the NIDA model
		public static bool[][] NidaSample(int nStudents, int nSkills, int[][] skillsRequired, Beta slipPrior, Beta guessPrior,
			out double[] pSkillOut, out double[] slip, out double[] guess, out bool[][] hasSkill)
		{
			int nQuestions = skillsRequired.Length;
			double[] pSkill = Util.ArrayInit(nSkills, q => Rand.Double());
			slip = Util.ArrayInit(nSkills, s => slipPrior.Sample());
			guess = Util.ArrayInit(nSkills, s => guessPrior.Sample());
			hasSkill = Util.ArrayInit(nStudents, t => Util.ArrayInit(nSkills, s => Rand.Double() < pSkill[s]));
			bool[][] responses = new bool[nStudents][];
			for (int t = 0; t < nStudents; t++) {
				responses[t] = new bool[nQuestions];
				for (int q = 0; q < nQuestions; q++) {
					bool[] exhibitsSkill = new bool[skillsRequired[q].Length];
					for (int s = 0; s < skillsRequired[q].Length; s++) {
						int skill = skillsRequired[q][s];
						if (hasSkill[t][skill]) exhibitsSkill[s] = (Rand.Double() > slip[skill]);
						else exhibitsSkill[s] = (Rand.Double() < guess[skill]);
					}
					responses[t][q] = Factor.AllTrue(exhibitsSkill);
				}
			}
			pSkillOut = pSkill;
			return responses;
		}
开发者ID:xornand,项目名称:Infer.Net,代码行数:25,代码来源:StudentSkills.cs


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