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


Java RealVector.getData方法代码示例

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


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

示例1: createAvgProductVector

import org.apache.commons.math.linear.RealVector; //导入方法依赖的package包/类
public double[] createAvgProductVector(List<Long> recentitemInteractions,Map<Long,float[]> productFeatures)
  {
  	int numLatentFactors = productFeatures.values().iterator().next().length;
  	double[] userFeatures = new double[numLatentFactors];
  	for (Long item : recentitemInteractions) 
{
  		float[] productFactors = productFeatures.get(item);
  		if (productFactors != null)
  		{
  			for (int feature = 0; feature < numLatentFactors; feature++) 
  			{
  				userFeatures[feature] += productFactors[feature];
  			}
  		}
}
  	RealVector  userFeaturesAsVector = new ArrayRealVector(userFeatures);
  	RealVector normalised =  userFeaturesAsVector.mapDivide(userFeaturesAsVector.getL1Norm());

  	return normalised.getData();
  }
 
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:21,代码来源:RecentMfRecommender.java

示例2: calculateInitialState

import org.apache.commons.math.linear.RealVector; //导入方法依赖的package包/类
/**
 * Calculates the initial state.
 * @return the initial state
 */
private double[] calculateInitialState() {
	if (numberOfCoefficients == 1) {
		//initial state is always numberOfCoefficients - 1.
		return new double[0];
	} else {
		RealMatrix zin = calculateZIN();
		RealVector zid = calculateZID();
		RealVector zi = getInvertedMatrix(zin).operate(zid);

		return zi.getData();
	}
}
 
开发者ID:BrainTech,项目名称:svarog,代码行数:17,代码来源:InitialStateCalculator.java

示例3: getInvertedCoeffiecientSum

import org.apache.commons.math.linear.RealVector; //导入方法依赖的package包/类
/**
 * Get the -1 times the sum of all coefficients in the given array.
 * @param coefficients coefficients to sum
 * @return the -1 times the sum of all coefficients in the given array.
 */
protected static double getInvertedCoeffiecientSum(final RealVector coefficients) {
    double sum = 0;
    for (double coefficient : coefficients.getData()) {
        sum -= coefficient;
    }
    return sum;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:SimplexTableau.java

示例4: unwrap

import org.apache.commons.math.linear.RealVector; //导入方法依赖的package包/类
/**
 * @param x A Commons vector, not null
 * @return An OG 1-D matrix of doubles
 */
public static DoubleMatrix1D unwrap(final RealVector x) {
  Validate.notNull(x);
  return new DoubleMatrix1D(x.getData());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:9,代码来源:CommonsMathWrapper.java

示例5: estimateResiduals

import org.apache.commons.math.linear.RealVector; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public double[] estimateResiduals() {
    RealVector b = calculateBeta();
    RealVector e = Y.subtract(X.operate(b));
    return e.getData();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:AbstractMultipleLinearRegression.java

示例6: estimateRegressionParameters

import org.apache.commons.math.linear.RealVector; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public double[] estimateRegressionParameters() {
    RealVector b = calculateBeta();
    return b.getData();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:AbstractMultipleLinearRegression.java

示例7: assertVectorEquals

import org.apache.commons.math.linear.RealVector; //导入方法依赖的package包/类
/**
 * Asserts that the elements of two vectors are equal concerning
 * a delta.
 *
 * @param expected the expected values
 * @param actual the actual values
 * @param delta determines how much the actual value can be different from the expected
 * value for the assertion to hold true
 */
public static void assertVectorEquals(RealVector expected, RealVector actual, double delta) {
	double[] expectedData = expected.getData();
	double[] actualData = actual.getData();

	assertArrayEquals(expectedData, actualData, delta);
}
 
开发者ID:BrainTech,项目名称:svarog,代码行数:16,代码来源:SignalMLAssert.java


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