本文整理汇总了Java中org.ejml.simple.SimpleMatrix.plus方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleMatrix.plus方法的具体用法?Java SimpleMatrix.plus怎么用?Java SimpleMatrix.plus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ejml.simple.SimpleMatrix
的用法示例。
在下文中一共展示了SimpleMatrix.plus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actualizarParametrosMomentum
import org.ejml.simple.SimpleMatrix; //导入方法依赖的package包/类
/**
* W(+1) = W - stepSize * [(Dw / m)+ W * reg] <br>
* B(+1) = B - stepSize * (Db / m) <br>
*
* @param m cantidad de datos
*/
protected void actualizarParametrosMomentum(double m) {
for (int i = 0; i < net.getLayers().size(); i++) {
Layer layer = net.getLayers().get(i);
SimpleMatrix W = layer.getW();
SimpleMatrix B = layer.getB();
SimpleMatrix reg = W.scale(regularization);
SimpleMatrix vW = deltasWprev.get(i).scale(momentum).minus(deltasW.get(i).divide(m).plus(reg).scale(learningRate));
W = W.plus(vW);
SimpleMatrix vB = deltasBprev.get(i).scale(momentum).minus(deltasB.get(i).divide(m).scale(learningRate));
B = B.plus(vB);
layer.setW(W);
layer.setB(B);
net.getLayers().set(i, layer);
deltasBprev.set(i, vB);
deltasWprev.set(i, vW);
}
}
示例2: evaluateMatrices
import org.ejml.simple.SimpleMatrix; //导入方法依赖的package包/类
String evaluateMatrices(AdvancedDisplay display) throws SyntaxException {
try {
SimpleMatrix matrix = null;
boolean add = false;
boolean multiply = false;
for(int i = 0; i < display.getChildCount(); i++) {
View child = display.getChildAt(i);
if(child instanceof MatrixView) {
if(!add && !multiply) {
matrix = ((MatrixView) child).getSimpleMatrix();
}
else if(add) {
add = false;
if(matrix == null) throw new SyntaxException();
matrix = matrix.plus(((MatrixView) child).getSimpleMatrix());
}
else if(multiply) {
multiply = false;
if(matrix == null) throw new SyntaxException();
matrix = matrix.mult(((MatrixView) child).getSimpleMatrix());
}
}
else if(child instanceof MatrixTransposeView) {
if(matrix == null) throw new SyntaxException();
matrix = matrix.transpose();
}
else if(child instanceof MatrixInverseView) {
if(matrix == null) throw new SyntaxException();
matrix = matrix.invert();
}
else {
String text = child.toString();
if(text.length() > 1) throw new SyntaxException();
else if(text.length() == 0) continue;
if(text.startsWith(String.valueOf(Logic.MUL))) multiply = true;
else if(text.startsWith(String.valueOf(Logic.PLUS))) add = true;
else throw new SyntaxException();
}
}
return logic.mBaseModule.updateTextToNewMode(MatrixView.matrixToString(matrix, logic), Mode.DECIMAL, logic.mBaseModule.getMode());
}
catch(Exception e) {
throw new SyntaxException();
}
}