本文整理汇总了Java中cc.mallet.types.MatrixOps.stddev方法的典型用法代码示例。如果您正苦于以下问题:Java MatrixOps.stddev方法的具体用法?Java MatrixOps.stddev怎么用?Java MatrixOps.stddev使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cc.mallet.types.MatrixOps
的用法示例。
在下文中一共展示了MatrixOps.stddev方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例5: 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);
}
示例6: 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);
}