likely.js
function calculateBias(input)
{
	var inputMatrix = $M(input);
	var average = calculateMatrixAverage(inputMatrix);
	var rowAverages = calculateRowAverage(inputMatrix);
	var colAverages = calculateColumnAverage(inputMatrix);
	
	var rowBiases = new Array();
	var colBiases = new Array();
	
	// The row bias is the difference between the row average and the overall average
	for(var i = 1; i <= rowAverages.dimensions().cols; i++)
	{
		rowBiases[i-1] = rowAverages.e(i) - average;
	}
	
	// the column bias is the difference between the column average and the overall average
	for(var i = 1; i <= colAverages.dimensions().cols; i++)
	{
		colBiases[i-1] = colAverages.e(i) - average;
	}
	
	var biases = new Bias(average, $V(rowBiases), $V(colBiases));
	
	return biases;
}
function calculateBias(input)
{
	var inputMatrix = $M(input);
	var average = calculateMatrixAverage(inputMatrix);
	var rowAverages = calculateRowAverage(inputMatrix);
	var colAverages = calculateColumnAverage(inputMatrix);
	
	var rowBiases = new Array();
	var colBiases = new Array();
	
	// The row bias is the difference between the row average and the overall average
	for(var i = 1; i <= rowAverages.dimensions().cols; i++)
	{
		rowBiases[i-1] = rowAverages.e(i) - average;
	}
	
	// the column bias is the difference between the column average and the overall average
	for(var i = 1; i <= colAverages.dimensions().cols; i++)
	{
		colBiases[i-1] = colAverages.e(i) - average;
	}
	
	var biases = new Bias(average, $V(rowBiases), $V(colBiases));
	
	return biases;
}
function calculateBias ( input ) { var inputMatrix = $M ( input ) ; var average = calculateMatrixAverage ( inputMatrix ) ; var rowAverages = calculateRowAverage ( inputMatrix ) ; var colAverages = calculateColumnAverage ( inputMatrix ) ; var rowBiases = new Array ( ) ; var colBiases = new Array ( ) ; // The row bias is the difference between the row average and the overall average for ( var i = 1 ; i <= rowAverages . dimensions ( ) . cols ; i ++ ) { rowBiases [ i - 1 ] = rowAverages . e ( i ) - average ; } // the column bias is the difference between the column average and the overall average for ( var i = 1 ; i <= colAverages . dimensions ( ) . cols ; i ++ ) { colBiases [ i - 1 ] = colAverages . e ( i ) - average ; } var biases = new Bias ( average , $V ( rowBiases ) , $V ( colBiases ) ) ; return biases ; }
Computes the biases from a matrix of values.
@param input A matrix of the input values
@returns Bias Object containing the average, bias for rows and bias for columns.
Computes the biases from a matrix of values .