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


Java Vector.assertSameDimensionality方法代码示例

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

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

示例1: logEvaluate

import gov.sandia.cognition.math.matrix.Vector; //导入方法依赖的package包/类
@Override
public double logEvaluate(
    final Vector input)
{
    Vector xn = input.scale( 1.0 / input.norm1() );

    Vector a = this.getParameters();
    input.assertSameDimensionality( a );

    double logsum = 0.0;
    final int K = a.getDimensionality();
    for( int i = 0; i < K; i++ )
    {
        double xi = xn.getElement(i);
        if( (xi <= 0.0) || (1.0 <= xi) )
        {
            throw new IllegalArgumentException(
                "Expected all inputs to be (0.0,infinity): " + input );
        }
        double ai = a.getElement(i);
        logsum += (ai-1.0) * Math.log( xi );
    }

    logsum -= MathUtil.logMultinomialBetaFunction( a );
    return logsum;
}
 
开发者ID:algorithmfoundry,项目名称:Foundry,代码行数:27,代码来源:DirichletDistribution.java


示例2: convertFromVector

import gov.sandia.cognition.math.matrix.Vector; //导入方法依赖的package包/类
@Override
public void convertFromVector(
    final Vector parameters)
{
    parameters.assertSameDimensionality( this.getParameters() );
    this.setParameters( ObjectUtil.cloneSafe(parameters) );
}
 
开发者ID:algorithmfoundry,项目名称:Foundry,代码行数:8,代码来源:MultivariatePolyaDistribution.java


示例3: evaluate

import gov.sandia.cognition.math.matrix.Vector; //导入方法依赖的package包/类
/**
 * Evaluates the Dirichlet PDF about the given input.  Note that we
 * normalize the given input by its L1 norm to ensure that its entries
 * sum to 1.
 * @param input
 * Input to consider, automatically normalized by its L1 norm without
 * side-effect.
 * @return
 * Dirichlet PDF evaluated about the given (unnormalized) input.
 */
@Override
public Double evaluate(
    final Vector input)
{
    Vector xn = input.scale( 1.0 / input.norm1() );

    Vector a = this.getParameters();
    input.assertSameDimensionality( a );

    double logsum = 0.0;
    final int K = a.getDimensionality();
    for( int i = 0; i < K; i++ )
    {
        double xi = xn.getElement(i);
        if( (xi <= 0.0) || (1.0 <= xi) )
        {
            throw new IllegalArgumentException(
                "Expected all inputs to be (0.0,infinity): " + input );
        }
        double ai = a.getElement(i);
        logsum += (ai-1.0) * Math.log( xi );
    }
    logsum -= MathUtil.logMultinomialBetaFunction( a );
    
    return Math.exp(logsum);
}
 
开发者ID:algorithmfoundry,项目名称:Foundry,代码行数:37,代码来源:DirichletDistribution.java


示例4: createConditionalDistribution

import gov.sandia.cognition.math.matrix.Vector; //导入方法依赖的package包/类
@Override
public MultinomialDistribution createConditionalDistribution(
    Vector parameter)
{
    parameter.assertSameDimensionality(
        this.parameter.getConditionalDistribution().getParameters() );
    return super.createConditionalDistribution(parameter);
}
 
开发者ID:algorithmfoundry,项目名称:Foundry,代码行数:9,代码来源:MultinomialBayesianEstimator.java


示例5: setValue

import gov.sandia.cognition.math.matrix.Vector; //导入方法依赖的package包/类
public void setValue(
    Vector value)
{
    value.assertSameDimensionality(
        this.conditionalDistribution.getParameters() );
    this.conditionalDistribution.setParameters(value);
}
 
开发者ID:algorithmfoundry,项目名称:Foundry,代码行数:8,代码来源:MultinomialBayesianEstimator.java



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