本文整理了Java中Jama.Matrix.plusEquals()
方法的一些代码示例,展示了Matrix.plusEquals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.plusEquals()
方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:plusEquals
暂无
代码示例来源:origin: openimaj/openimaj
private void updateMean(Matrix point) {
Matrix newMean = mean.times(DAMPENING);
newMean.plusEquals(point.times(1 - DAMPENING));
mean = newMean;
}
private void redrawEllipses() {
代码示例来源:origin: org.openimaj/sandbox
private void updateMean(Matrix point) {
Matrix newMean = mean.times(DAMPENING);
newMean.plusEquals(point.times(1 - DAMPENING));
mean = newMean;
}
private void redrawEllipses() {
代码示例来源:origin: cmu-phil/tetrad
/**
* Compute compute test set covariances
* @param loghyper column <code>Matrix</code> of hyperparameters
* @param X input dataset
* @param Xstar test set
* @return [K(Xstar,Xstar) K(X,Xstar)]
*/
public Matrix[] compute(Matrix loghyper, Matrix X, Matrix Xstar){
Matrix A = new Matrix(Xstar.getRowDimension(),1);
Matrix B = new Matrix(X.getRowDimension(),Xstar.getRowDimension());
for(int i=0; i<f.length; i++){
Matrix loghyperi = loghyper.getMatrix(idx[i],idx[i+1]-1,0,0);
Matrix[] K = f[i].compute(loghyperi,X,Xstar);
A.plusEquals(K[0]);
B.plusEquals(K[1]);
}
return new Matrix[]{A,B};
}
代码示例来源:origin: cmu-phil/tetrad
/**
* Sums across the rows of the <code>Matrix</code> and return the result as a single column <code>MAtrix</code>
* @param A input <code>Matrix</code>
* @return result
*/
public static Matrix sumRows(Matrix A){
Matrix sum = new Matrix(A.getRowDimension(),1);
for(int i=0; i<A.getColumnDimension(); i++)
sum.plusEquals(A.getMatrix(0,A.getRowDimension()-1,i,i));
return sum;
}
代码示例来源:origin: cmu-phil/tetrad
private static Matrix sumColumns(Matrix a){
Matrix sum = new Matrix(1,a.getColumnDimension());
for(int i=0; i<a.getRowDimension(); i++)
sum.plusEquals(a.getMatrix(i,i,0,a.getColumnDimension()-1));
return sum;
}
代码示例来源:origin: cmu-phil/tetrad
/**
* Compute covariance matrix of a dataset X
* @param loghyper column <code>Matrix</code> of hyperparameters
* @param X input dataset
* @return K covariance <code>Matrix</code>
*/
public Matrix compute(Matrix loghyper, Matrix X){
Matrix K = new Matrix(X.getRowDimension(),X.getRowDimension());
for(int i=0; i<f.length; i++){
Matrix loghyperi = loghyper.getMatrix(idx[i],idx[i+1]-1,0,0);
K.plusEquals(f[i].compute(loghyperi,X));
}
return K;
}
代码示例来源:origin: broadgsa/gatk-protected
sigma.plusEquals( pVarSigma );
sigma.plusEquals( empiricalSigma );
sigma.plusEquals( wishart );
代码示例来源:origin: net.sf.meka/meka
/**
* Update - Carry out one epoch of CD, update W.
* We use dW_ to manage momentum.
* <br>
* TODO weight decay SHOULD NOT BE APPLIED TO BIASES
* @param X X
*/
public void update(Matrix X) {
Matrix CD = epoch(X);
Matrix dW = (CD.minusEquals(this.W.times(COST))).timesEquals(LEARNING_RATE); // with COST
this.W.plusEquals(dW.plus(this.dW_.timesEquals(MOMENTUM))); // with MOMENTUM.
this.dW_ = dW; // for the next update
}
代码示例来源:origin: Waikato/meka
/**
* Update - Carry out one epoch of CD, update W.
* We use dW_ to manage momentum.
* <br>
* TODO weight decay SHOULD NOT BE APPLIED TO BIASES
* @param X X
*/
public void update(Matrix X) {
Matrix CD = epoch(X);
Matrix dW = (CD.minusEquals(this.W.times(COST))).timesEquals(LEARNING_RATE); // with COST
this.W.plusEquals(dW.plus(this.dW_.timesEquals(MOMENTUM))); // with MOMENTUM.
this.dW_ = dW; // for the next update
}
代码示例来源:origin: Waikato/meka
/**
* Update - Carry out one epoch of CD, update W.
* <br>
* TODO combine with above fn.
* @param X X
* @param s multiply the gradient by this scalar
*/
public void update(Matrix X, double s) {
Matrix CD = epoch(X);
Matrix dW = (CD.minusEquals(this.W.times(COST))).timesEquals(LEARNING_RATE); // with COST
dW = dW.times(s); // *scaling factor
this.W.plusEquals(dW.plus(this.dW_.timesEquals(MOMENTUM))); // with MOMENTUM.
this.dW_ = dW; // for the next update
}
代码示例来源:origin: net.sf.meka/meka
/**
* Update - Carry out one epoch of CD, update W.
* <br>
* TODO combine with above fn.
* @param X X
* @param s multiply the gradient by this scalar
*/
public void update(Matrix X, double s) {
Matrix CD = epoch(X);
Matrix dW = (CD.minusEquals(this.W.times(COST))).timesEquals(LEARNING_RATE); // with COST
dW = dW.times(s); // *scaling factor
this.W.plusEquals(dW.plus(this.dW_.timesEquals(MOMENTUM))); // with MOMENTUM.
this.dW_ = dW; // for the next update
}
代码示例来源:origin: senbox-org/s1tbx
for (int xx = xSt; xx <= xEd; ++xx) {
getCovarianceMatrixC3(srcIndex.getIndex(xx), dataBuffers, tempCr, tempCi);
CrMat.plusEquals(new Matrix(tempCr));
CiMat.plusEquals(new Matrix(tempCi));
getCoherencyMatrixT3(srcIndex.getIndex(xx), dataBuffers, tempTr, tempTi);
t3ToC3(tempTr, tempTi, tempCr, tempCi);
CrMat.plusEquals(new Matrix(tempCr));
CiMat.plusEquals(new Matrix(tempCi));
getComplexScatterMatrix(srcIndex.getIndex(xx), dataBuffers, tempSr, tempSi);
computeCovarianceMatrixC3(tempSr, tempSi, tempCr, tempCi);
CrMat.plusEquals(new Matrix(tempCr));
CiMat.plusEquals(new Matrix(tempCi));
代码示例来源:origin: senbox-org/s1tbx
for (int xx = xSt; xx <= xEd; ++xx) {
getCoherencyMatrixT3(srcIndex.getIndex(xx), dataBuffers, tempTr, tempTi);
TrMat.plusEquals(new Matrix(tempTr));
TiMat.plusEquals(new Matrix(tempTi));
getCovarianceMatrixC3(srcIndex.getIndex(xx), dataBuffers, tempCr, tempCi);
c3ToT3(tempCr, tempCi, tempTr, tempTi);
TrMat.plusEquals(new Matrix(tempTr));
TiMat.plusEquals(new Matrix(tempTi));
getComplexScatterMatrix(srcIndex.getIndex(xx), dataBuffers, tempSr, tempSi);
computeCoherencyMatrixT3(tempSr, tempSi, tempTr, tempTi);
TrMat.plusEquals(new Matrix(tempTr));
TiMat.plusEquals(new Matrix(tempTi));
代码示例来源:origin: percyliang/fig
public double [] sample(Random random)
{
Matrix L = getChol().getL();
// start with a vector of iid std normals
Matrix stdNormal = new Matrix(dim(), 1);
for (int i = 0; i < dim(); i++)
{
stdNormal.set(i, 0, SampleUtils.sampleGaussian(random));
}
Matrix result = L.times(stdNormal);
result.plusEquals(mean);
return result.getColumnPackedCopy();
}
public double[] sampleObject(Random random) { return sample(random); }
代码示例来源:origin: senbox-org/s1tbx
for (int xx = xSt; xx <= xEd; ++xx) {
getCovarianceMatrixC4(srcIndex.getIndex(xx), sourceProductType, dataBuffers, tempCr, tempCi);
CrMat.plusEquals(new Matrix(tempCr));
CiMat.plusEquals(new Matrix(tempCi));
代码示例来源:origin: senbox-org/s1tbx
CrMat.plusEquals(tmpCrMat);
CiMat.plusEquals(tmpCiMat);
代码示例来源:origin: broadgsa/gatk-protected
public void evaluateFinalModelParameters( final List<VariantDatum> data ) {
sumProb = 0.0;
zeroOutMu();
zeroOutSigma();
int datumIndex = 0;
for( final VariantDatum datum : data ) {
final double prob = pVarInGaussian.get(datumIndex++);
sumProb += prob;
incrementMu( datum, prob );
}
divideEqualsMu( sumProb );
datumIndex = 0;
final Matrix pVarSigma = new Matrix(mu.length, mu.length);
for( final VariantDatum datum : data ) {
final double prob = pVarInGaussian.get(datumIndex++);
for( int iii = 0; iii < mu.length; iii++ ) {
for( int jjj = 0; jjj < mu.length; jjj++ ) {
pVarSigma.set(iii, jjj, prob * (datum.annotations[iii]-mu[iii]) * (datum.annotations[jjj]-mu[jjj]));
}
}
sigma.plusEquals( pVarSigma );
}
sigma.timesEquals( 1.0 / sumProb );
resetPVarInGaussian(); // clean up some memory
}
代码示例来源:origin: openimaj/openimaj
@Override
protected void mstep(EMGMM gmm, GaussianMixtureModelEM learner, Matrix X, Matrix responsibilities,
Matrix weightedXsum,
double[] norm)
{
// Eq. 12 from K. Murphy,
// "Fitting a Conditional Linear Gaussian Distribution"
final int nfeatures = X.getColumnDimension();
for (int c = 0; c < learner.nComponents; c++) {
final Matrix post = responsibilities.getMatrix(0, X.getRowDimension() - 1, c, c).transpose();
final double factor = 1.0 / (ArrayUtils.sumValues(post.getArray()) + 10 * MathUtils.EPSILON);
final Matrix pXt = X.transpose();
for (int i = 0; i < pXt.getRowDimension(); i++)
for (int j = 0; j < pXt.getColumnDimension(); j++)
pXt.set(i, j, pXt.get(i, j) * post.get(0, j));
final Matrix argcv = pXt.times(X).times(factor);
final Matrix mu = ((FullMultivariateGaussian) gmm.gaussians[c]).mean;
((FullMultivariateGaussian) gmm.gaussians[c]).covar = argcv.minusEquals(mu.transpose().times(mu))
.plusEquals(Matrix.identity(nfeatures, nfeatures).times(learner.minCovar));
}
}
},
代码示例来源:origin: Waikato/meka
W[i].plusEquals(dW[i]);
代码示例来源:origin: net.sf.meka/meka
W[i].plusEquals(dW[i]);
内容来源于网络,如有侵权,请联系作者删除!