本文整理匯總了Java中com.rapidminer.operator.performance.EstimatedPerformance類的典型用法代碼示例。如果您正苦於以下問題:Java EstimatedPerformance類的具體用法?Java EstimatedPerformance怎麽用?Java EstimatedPerformance使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EstimatedPerformance類屬於com.rapidminer.operator.performance包,在下文中一共展示了EstimatedPerformance類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) throws OperatorException {
double[] values = individual.getValues();
double[][] coefficients = getCoefficients(values);
double[][] degrees = getDegrees(values);
double offset = getOffset(values);
double error = 0.0d;
for (Example example : exampleSet) {
double prediction = PolynomialRegressionModel.calculatePrediction(example, coefficients, degrees, offset);
double diff = Math.abs(example.getValue(label) - prediction);
error += diff * diff;
}
error = Math.sqrt(error);
PerformanceVector performanceVector = new PerformanceVector();
performanceVector.addCriterion(new EstimatedPerformance("Polynomial Regression Error", error, 1, true));
return performanceVector;
}
示例2: getOptimizationPerformance
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
/** Delivers the fitness of the best individual as performance vector. */
@Override
public PerformanceVector getOptimizationPerformance() {
double[] bestValuesEver = getBestValuesEver();
double[] finalFitness = optimizationFunction.getFitness(bestValuesEver, ys, kernel);
PerformanceVector result = new PerformanceVector();
if (finalFitness.length == 1) {
result.addCriterion(new EstimatedPerformance("svm_objective_function", finalFitness[0], 1, false));
} else {
result.addCriterion(new EstimatedPerformance("alpha_sum", finalFitness[0], 1, false));
result.addCriterion(new EstimatedPerformance("svm_objective_function", finalFitness[1], 1, false));
if (finalFitness.length == 3) {
result.addCriterion(new EstimatedPerformance("alpha_label_sum", finalFitness[2], 1, false));
}
}
return result;
}
示例3: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) throws OperatorException {
double[] values = individual.getValues();
double[][] coefficients = getCoefficients(values);
double[][] degrees = getDegrees(values);
double offset = getOffset(values);
double error = 0.0d;
for (Example example : exampleSet) {
double prediction = PolynomialRegressionModel.calculatePrediction(example, attributes, coefficients, degrees,
offset);
double diff = Math.abs(example.getValue(label) - prediction);
error += diff * diff;
}
error = Math.sqrt(error);
PerformanceVector performanceVector = new PerformanceVector();
performanceVector.addCriterion(new EstimatedPerformance("Polynomial Regression Error", error, 1, true));
return performanceVector;
}
示例4: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) {
double[] beta = individual.getValues();
double fitness = 0.0d;
for (Example example : exampleSet) {
double eta = 0.0d;
int i = 0;
for (Attribute attribute : example.getAttributes()) {
double value = example.getValue(attribute);
eta += beta[i] * value;
i++;
}
if (addIntercept) {
eta += beta[beta.length - 1];
}
double pi = Math.exp(eta) / (1 + Math.exp(eta));
double classValue = example.getValue(label);
double currentFitness = classValue * Math.log(pi) + (1 - classValue) * Math.log(1 - pi);
double weightValue = 1.0d;
if (weight != null) {
weightValue = example.getValue(weight);
}
fitness += weightValue * currentFitness;
}
PerformanceVector performanceVector = new PerformanceVector();
performanceVector.addCriterion(new EstimatedPerformance("log_reg_fitness", fitness, exampleSet.size(), false));
return performanceVector;
}
示例5: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
/** Evaluates the individuals of the given population. */
@Override
public PerformanceVector evaluateIndividual(double[] individual) {
double fitness = optimizationFunction.getFitness(individual, ys, kernel)[0];
PerformanceVector result = new PerformanceVector();
result.addCriterion(new EstimatedPerformance("SVMOptValue", fitness, 1, false));
return result;
}
示例6: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) {
double[] fitness = optimizationFunction.getFitness(individual.getValues(), ys, kernel);
PerformanceVector performanceVector = new PerformanceVector();
performanceVector.addCriterion(new EstimatedPerformance("SVM_fitness", fitness[0], 1, false));
performanceVector.addCriterion(new EstimatedPerformance("SVM_complexity", fitness[1], 1, false));
return performanceVector;
}
示例7: getOptimizationPerformance
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
/** Delivers the fitness of the best individual as performance vector. */
@Override
public PerformanceVector getOptimizationPerformance() {
double[] bestValuesEver = getBestValuesEver();
double[] finalFitness = optimizationFunction.getFitness(bestValuesEver, ys, kernel);
PerformanceVector result = new PerformanceVector();
result.addCriterion(new EstimatedPerformance("svm_objective_function", finalFitness[0], 1, false));
result.addCriterion(new EstimatedPerformance("no_support_vectors", -1 * finalFitness[1], 1, true));
return result;
}
示例8: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) {
double[] fitness = optimizationFunction.getFitness(individual.getValues(), ys, kernel);
PerformanceVector performanceVector = new PerformanceVector();
if (fitness.length == 1) {
performanceVector.addCriterion(new EstimatedPerformance("SVM_fitness", fitness[0], 1, false));
} else {
performanceVector.addCriterion(new EstimatedPerformance("alpha_sum", fitness[0], 1, false));
performanceVector.addCriterion(new EstimatedPerformance("svm_objective_function", fitness[1], 1, false));
if (fitness.length == 3) {
performanceVector.addCriterion(new EstimatedPerformance("alpha_label_sum", fitness[2], 1, false));
}
}
return performanceVector;
}
示例9: getOptimizationPerformance
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
/**
* Returns the optimization performance of the best result. This method must be called after
* training, not before.
*/
@Override
public PerformanceVector getOptimizationPerformance() {
double finalFitness = getFitness(svmExamples.get_alphas(), svmExamples.get_ys(), kernel);
PerformanceVector result = new PerformanceVector();
result.addCriterion(new EstimatedPerformance("svm_objective_function", finalFitness, 1, false));
result.addCriterion(new EstimatedPerformance("no_support_vectors", svmExamples.getNumberOfSupportVectors(), 1, true));
return result;
}
示例10: getEstimatedPerformance
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
/**
* Returns the estimated performances of this SVM. Does only work for classification tasks.
*/
@Override
public PerformanceVector getEstimatedPerformance() throws OperatorException {
if (!pattern) {
throw new UserError(this, 912, this, "Cannot calculate leave one out estimation of error for regression tasks!");
}
double[] estVector = ((SVMpattern) getSVM()).getXiAlphaEstimation(getKernel());
PerformanceVector pv = new PerformanceVector();
pv.addCriterion(new EstimatedPerformance("xialpha_error", estVector[0], 1, true));
pv.addCriterion(new EstimatedPerformance("xialpha_precision", estVector[1], 1, false));
pv.addCriterion(new EstimatedPerformance("xialpha_recall", estVector[2], 1, false));
pv.setMainCriterionName("xialpha_error");
return pv;
}
示例11: doWork
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public void doWork() throws OperatorException {
ClusterModel model = clusterModelInput.getData(ClusterModel.class);
ExampleDistributionMeasure measure = (ExampleDistributionMeasure) MEASURE_MAP
.getInstantiation(getParameterAsString(PARAMETER_MEASURE));
int totalNumberOfItems = 0;
int[] count = new int[model.getNumberOfClusters()];
for (int i = 0; i < model.getNumberOfClusters(); i++) {
int numItemsInCluster = model.getCluster(i).getNumberOfExamples();
totalNumberOfItems = totalNumberOfItems + numItemsInCluster;
count[i] = numItemsInCluster;
}
PerformanceVector performance = performanceInput.getDataOrNull(PerformanceVector.class);
if (performance == null) {
// If no performance vector is available create a new one
performance = new PerformanceVector();
}
distribution = measure.evaluate(count, totalNumberOfItems);
PerformanceCriterion criterion = new EstimatedPerformance("Example distribution", distribution, 1, false);
performance.addCriterion(criterion);
clusterModelOutput.deliver(model);
performanceOutput.deliver(performance);
}
示例12: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) {
double[] beta = individual.getValues();
double fitness = 0.0d;
Attribute[] regularAttributes = exampleSet.getAttributes().createRegularAttributeArray();
for (Example example : exampleSet) {
double eta = 0.0d;
int i = 0;
for (Attribute attribute : regularAttributes) {
double value = example.getValue(attribute);
eta += beta[i] * value;
i++;
}
if (addIntercept) {
eta += beta[beta.length - 1];
}
double pi = Math.exp(eta) / (1 + Math.exp(eta));
double classValue = example.getValue(label);
double currentFitness = classValue * Math.log(pi) + (1 - classValue) * Math.log(1 - pi);
double weightValue = 1.0d;
if (weight != null) {
weightValue = example.getValue(weight);
}
fitness += weightValue * currentFitness;
}
PerformanceVector performanceVector = new PerformanceVector();
performanceVector.addCriterion(new EstimatedPerformance("log_reg_fitness", fitness, exampleSet.size(), false));
return performanceVector;
}
示例13: doWork
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public void doWork() throws OperatorException {
ClusterModel model = clusterModelInput.getData(ClusterModel.class);
ExampleDistributionMeasure measure = (ExampleDistributionMeasure) MEASURE_MAP.getInstantiation(getParameterAsString(PARAMETER_MEASURE));
int totalNumberOfItems = 0;
int[] count = new int[model.getNumberOfClusters()];
for (int i = 0; i < model.getNumberOfClusters(); i++) {
int numItemsInCluster = model.getCluster(i).getNumberOfExamples();
totalNumberOfItems = totalNumberOfItems + numItemsInCluster;
count[i] = numItemsInCluster;
}
PerformanceVector performance = performanceInput.getDataOrNull(PerformanceVector.class);
if (performance == null) {
// If no performance vector is available create a new one
performance = new PerformanceVector();
}
distribution = measure.evaluate(count, totalNumberOfItems);
PerformanceCriterion criterion = new EstimatedPerformance("Example distribution", distribution, 1, false);
performance.addCriterion(criterion);
clusterModelOutput.deliver(model);
performanceOutput.deliver(performance);
}
示例14: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) {
double[] beta = individual.getValues();
double fitness = 0.0d;
for (Example example : exampleSet) {
double eta = 0.0d;
int i = 0;
for (Attribute attribute : example.getAttributes()) {
double value = example.getValue(attribute);
eta += beta[i] * value;
i++;
}
if (addIntercept) {
eta += beta[beta.length - 1];
}
double pi = Math.exp(eta) / (1 + Math.exp(eta));
double classValue = example.getValue(label);
double currentFitness = classValue * Math.log(pi) + (1 - classValue) * Math.log(1 - pi);
double weightValue = 1.0d;
if (weight != null)
weightValue = example.getValue(weight);
fitness += weightValue * currentFitness;
}
PerformanceVector performanceVector = new PerformanceVector();
performanceVector.addCriterion(new EstimatedPerformance("log_reg_fitness", fitness, exampleSet.size(), false));
return performanceVector;
}
示例15: evaluateIndividual
import com.rapidminer.operator.performance.EstimatedPerformance; //導入依賴的package包/類
@Override
public PerformanceVector evaluateIndividual(Individual individual) {
double[] fitness = optimizationFunction.getFitness(individual.getValues(), ys, kernel);
PerformanceVector performanceVector = new PerformanceVector();
performanceVector.addCriterion(new EstimatedPerformance("SVM_fitness", fitness[0], 1, false));
performanceVector.addCriterion(new EstimatedPerformance("SVM_complexity", fitness[1], 1, false));
return performanceVector;
}