计算公式:
并通过以下代码对Mahout in Action的结果进行了验证: 代码例如以下: ` package com.example.mahout;public class TestColl {
public static void main(String[] args) { // TODO Auto-generated method stub //int a[]={68,71,62,75,58,60,67,68,71,69,68,67,63,62,60,63,65,67,63,61}; //double b[] ={4.1,4.6,3.8,4.4,3.2,3.1,3.8,4.1,4.3,3.7,3.5,3.2,3.7,3.3,3.4,4.0,4.1,3.8,3.4,3.6}; double a[]={5,3.0,2.5}; double b[]={4,3,2.0}; int i,j; double sum_a=0,sum_b=0,sum_XY=0,sum_X=0,sum_Y=0,sum_X2=0,sum_Y2=0; double mean_a,var_a,mean_b,var_b; for(i=0;i
}
`