use of org.apache.commons.math3.optim.MaxEval in project tetrad by cmu-phil.
the class Mimbuild2 method optimizeNonMeasureVariancesConditionally.
private void optimizeNonMeasureVariancesConditionally(Node[][] indicators, TetradMatrix measurescov, TetradMatrix latentscov, double[][] loadings, int[][] indicatorIndices, double[] delta) {
int count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
count++;
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
count++;
}
}
double[] values3 = new double[count];
count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
values3[count] = latentscov.get(i, j);
count++;
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
values3[count] = loadings[i][j];
count++;
}
}
Function2 function2 = new Function2(indicatorIndices, measurescov, loadings, latentscov, delta, count);
MultivariateOptimizer search = new PowellOptimizer(1e-7, 1e-7);
PointValuePair pair = search.optimize(new InitialGuess(values3), new ObjectiveFunction(function2), GoalType.MINIMIZE, new MaxEval(100000));
minimum = pair.getValue();
}
use of org.apache.commons.math3.optim.MaxEval in project tetrad by cmu-phil.
the class Mimbuild2 method optimizeNonMeasureVariancesQuick.
private void optimizeNonMeasureVariancesQuick(Node[][] indicators, TetradMatrix measurescov, TetradMatrix latentscov, double[][] loadings, int[][] indicatorIndices) {
int count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
count++;
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
count++;
}
}
double[] values = new double[count];
count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
values[count++] = latentscov.get(i, j);
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
values[count++] = loadings[i][j];
}
}
Function1 function1 = new Function1(indicatorIndices, measurescov, loadings, latentscov, count);
MultivariateOptimizer search = new PowellOptimizer(1e-7, 1e-7);
PointValuePair pair = search.optimize(new InitialGuess(values), new ObjectiveFunction(function1), GoalType.MINIMIZE, new MaxEval(100000));
minimum = pair.getValue();
}
use of org.apache.commons.math3.optim.MaxEval in project tetrad by cmu-phil.
the class MimbuildTrek method optimizeNonMeasureVariancesConditionally.
private void optimizeNonMeasureVariancesConditionally(Node[][] indicators, TetradMatrix measurescov, TetradMatrix latentscov, double[][] loadings, int[][] indicatorIndices, double[] delta) {
int count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
count++;
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
count++;
}
}
double[] values3 = new double[count];
count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
values3[count] = latentscov.get(i, j);
count++;
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
values3[count] = loadings[i][j];
count++;
}
}
Function2 function2 = new Function2(indicatorIndices, measurescov, loadings, latentscov, delta, count);
MultivariateOptimizer search = new PowellOptimizer(1e-7, 1e-7);
PointValuePair pair = search.optimize(new InitialGuess(values3), new ObjectiveFunction(function2), GoalType.MINIMIZE, new MaxEval(100000));
minimum = pair.getValue();
}
use of org.apache.commons.math3.optim.MaxEval in project tetrad by cmu-phil.
the class MimbuildTrek method optimizeMeasureVariancesConditionally.
private void optimizeMeasureVariancesConditionally(TetradMatrix measurescov, TetradMatrix latentscov, double[][] loadings, int[][] indicatorIndices, double[] delta) {
double[] values2 = new double[delta.length];
int count = 0;
for (int i = 0; i < delta.length; i++) {
values2[count++] = delta[i];
}
Function2 function2 = new Function2(indicatorIndices, measurescov, loadings, latentscov, delta, count);
MultivariateOptimizer search = new PowellOptimizer(1e-7, 1e-7);
PointValuePair pair = search.optimize(new InitialGuess(values2), new ObjectiveFunction(function2), GoalType.MINIMIZE, new MaxEval(100000));
minimum = pair.getValue();
}
use of org.apache.commons.math3.optim.MaxEval in project tetrad by cmu-phil.
the class MimbuildTrek method optimizeNonMeasureVariancesQuick.
private void optimizeNonMeasureVariancesQuick(Node[][] indicators, TetradMatrix measurescov, TetradMatrix latentscov, double[][] loadings, int[][] indicatorIndices) {
int count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
count++;
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
count++;
}
}
double[] values = new double[count];
count = 0;
for (int i = 0; i < indicators.length; i++) {
for (int j = i; j < indicators.length; j++) {
values[count++] = latentscov.get(i, j);
}
}
for (int i = 0; i < indicators.length; i++) {
for (int j = 0; j < indicators[i].length; j++) {
values[count++] = loadings[i][j];
}
}
Function1 function1 = new Function1(indicatorIndices, measurescov, loadings, latentscov, count);
MultivariateOptimizer search = new PowellOptimizer(1e-7, 1e-7);
PointValuePair pair = search.optimize(new InitialGuess(values), new ObjectiveFunction(function1), GoalType.MINIMIZE, new MaxEval(100000));
minimum = pair.getValue();
}
Aggregations