本文整理汇总了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);
}
示例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: 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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}