public long realignAll() { int i; long start = CSettings.currentTimeMillis(); CXYVector.realign(_trainingData[0], _mean, _weight); _newMean = new CXYVector(_trainingData[0]); for (i = 1; i < _numSamples; i++) { CXYVector.realign(_trainingData[i], _mean, _weight); _newMean.add(_trainingData[i]); } _newMean.divide(_numSamples); return(CSettings.currentTimeMillis() - start); }
public CPointDistributionModel principalComponentAnalysis(Size clippingSize, out long time) { long start = CSettings.currentTimeMillis(); // Get Covarian Matrix CMatrix s = new CMatrix(_numPoints * 2, false); for (int i = 0; i < _numSamples; i++) { CVector dx = new CVector(_trainingData[i].substractCopy(_mean)); CMatrix dxdxT = dx.multiplyMatrix(dx); s.add(dxdxT); } s.divide(_numSamples); // Calculate Eigen CPointDistributionModel ret = new CPointDistributionModel(clippingSize, _mean, CEigen.calculate(s), 7, _connectivity); long end = CSettings.currentTimeMillis(); time = end - start; return(ret); }