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


Java MatrixOps.mean方法代码示例

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


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

示例1: testSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new UniNormalFactor (var, -1.0, 2.0);
  TDoubleArrayList lst = new TDoubleArrayList ();
  for (int i = 0; i < 10000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toNativeArray ();
  double mean = MatrixOps.mean (vals);
  double std = MatrixOps.stddev (vals);
  assertEquals (-1.0, mean, 0.025);
  assertEquals (Math.sqrt(2.0), std, 0.01);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:18,代码来源:TestUniNormalFactor.java

示例2: testSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new UniNormalFactor (var, -1.0, 2.0);
  TDoubleArrayList lst = new TDoubleArrayList();
  for (int i = 0; i < 10000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  double std = MatrixOps.stddev (vals);
  assertEquals (-1.0, mean, 0.025);
  assertEquals (Math.sqrt(2.0), std, 0.01);
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:18,代码来源:TestUniNormalFactor.java

示例3: ignoretestSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void ignoretestSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new UniNormalFactor (var, -1.0, 2.0);
  DoubleArrayList lst = new DoubleArrayList ();
  for (int i = 0; i < 10000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  double std = MatrixOps.stddev (vals);
  assertEquals (-1.0, mean, 0.025);
  assertEquals (Math.sqrt(2.0), std, 0.01);
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:18,代码来源:TestUniNormalFactor.java

示例4: checkMeanStd

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
void checkMeanStd (TDoubleArrayList ell, double mu, double sigma)
{
  double[] vals = ell.toNativeArray ();
  double mean1 = MatrixOps.mean (vals);
  double std1 = MatrixOps.stddev (vals);
  assertEquals (mu, mean1, 0.025);
  assertEquals (sigma, std1, 0.01);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:9,代码来源:TestNormalFactor.java

示例5: testSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new BetaFactor (var, 0.7, 0.5);
  TDoubleArrayList lst = new TDoubleArrayList ();
  for (int i = 0; i < 100000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toNativeArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (0.7 / (0.5 + 0.7), mean, 0.01);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:16,代码来源:TestBetaFactor.java

示例6: testSample2

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample2 ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new BetaFactor (var, 0.7, 0.5, 3.0, 8.0);
  TDoubleArrayList lst = new TDoubleArrayList ();
  for (int i = 0; i < 100000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toNativeArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (5.92, mean, 0.01);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:16,代码来源:TestBetaFactor.java

示例7: testSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new UniformFactor (var, -1.0, 1.5);
  TDoubleArrayList lst = new TDoubleArrayList ();
  for (int i = 0; i < 10000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toNativeArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (0.25, mean, 0.01);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:16,代码来源:TestUniformFactor.java

示例8: checkMeanStd

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
void checkMeanStd (TDoubleArrayList ell, double mu, double sigma)
{
  double[] vals = ell.toArray ();
  double mean1 = MatrixOps.mean (vals);
  double std1 = MatrixOps.stddev (vals);
  assertEquals (mu, mean1, 0.025);
  assertEquals (sigma, std1, 0.01);
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:9,代码来源:TestNormalFactor.java

示例9: testSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new BetaFactor (var, 0.7, 0.5);
  TDoubleArrayList lst = new TDoubleArrayList ();
  for (int i = 0; i < 100000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (0.7 / (0.5 + 0.7), mean, 0.01);
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:16,代码来源:TestBetaFactor.java

示例10: testSample2

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample2 ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new BetaFactor (var, 0.7, 0.5, 3.0, 8.0);
  TDoubleArrayList lst = new TDoubleArrayList ();
  for (int i = 0; i < 100000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (5.92, mean, 0.01);
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:16,代码来源:TestBetaFactor.java

示例11: testSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new UniformFactor (var, -1.0, 1.5);
  TDoubleArrayList lst = new TDoubleArrayList ();
  for (int i = 0; i < 10000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (0.25, mean, 0.01);
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:16,代码来源:TestUniformFactor.java

示例12: checkMeanStd

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
void checkMeanStd (DoubleArrayList ell, double mu, double sigma)
{
  double[] vals = ell.toArray ();
  double mean1 = MatrixOps.mean (vals);
  double std1 = MatrixOps.stddev (vals);
  assertEquals (mu, mean1, 0.025);
  assertEquals (sigma, std1, 0.01);
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:9,代码来源:TestNormalFactor.java

示例13: testSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new BetaFactor (var, 0.7, 0.5);
  DoubleArrayList lst = new DoubleArrayList ();
  for (int i = 0; i < 100000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (0.7 / (0.5 + 0.7), mean, 0.01);
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:16,代码来源:TestBetaFactor.java

示例14: testSample2

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void testSample2 ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new BetaFactor (var, 0.7, 0.5, 3.0, 8.0);
  DoubleArrayList lst = new DoubleArrayList ();
  for (int i = 0; i < 100000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (5.92, mean, 0.01);
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:16,代码来源:TestBetaFactor.java

示例15: ignoretestSample

import cc.mallet.types.MatrixOps; //导入方法依赖的package包/类
public void ignoretestSample ()
{
  Variable var = new Variable (Variable.CONTINUOUS);
  Randoms r = new Randoms (2343);
  Factor f = new UniformFactor (var, -1.0, 1.5);
  DoubleArrayList lst = new DoubleArrayList ();
  for (int i = 0; i < 10000; i++) {
    Assignment assn = f.sample (r);
    lst.add (assn.getDouble (var));
  }

  double[] vals = lst.toArray ();
  double mean = MatrixOps.mean (vals);
  assertEquals (0.25, mean, 0.01);
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:16,代码来源:TestUniformFactor.java


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