当前位置: 首页>>代码示例>>Java>>正文


Java Individual.getWeights方法代码示例

本文整理汇总了Java中com.rapidminer.operator.features.Individual.getWeights方法的典型用法代码示例。如果您正苦于以下问题:Java Individual.getWeights方法的具体用法?Java Individual.getWeights怎么用?Java Individual.getWeights使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rapidminer.operator.features.Individual的用法示例。


在下文中一共展示了Individual.getWeights方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: operate

import com.rapidminer.operator.features.Individual; //导入方法依赖的package包/类
@Override
public List<Individual> operate(Individual individual) {
	double[] weights = individual.getWeights();

	List<Individual> l = new LinkedList<Individual>();
	for (int i = 0; i < weights.length; i++) {
		if (weights[i] > 0) {
			double[] newWeights = new double[weights.length];
			System.arraycopy(weights, 0, newWeights, 0, weights.length);
			newWeights[i] = 0;
			Individual newIndividual = new Individual(newWeights);
			if (newIndividual.getNumberOfUsedAttributes() > 0) {
				l.add(newIndividual);
			}
		}
	}
	return l;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:BackwardElimination.java

示例2: operate

import com.rapidminer.operator.features.Individual; //导入方法依赖的package包/类
@Override
public void operate(Population pop) throws Exception {
	Individual bestIndividual = pop.getBestIndividualEver();
	if (bestIndividual != null) {
		File outputFile = operator.getParameterAsFile(AbstractGeneticAlgorithm.PARAMETER_INTERMEDIATE_WEIGHTS_FILE,
				true);
		if (outputFile != null) {
			double[] weightValues = bestIndividual.getWeights();
			if (weightValues.length == attributeNames.length) {
				AttributeWeights weights = new AttributeWeights();
				for (int i = 0; i < weightValues.length; i++) {
					weights.setWeight(attributeNames[i], weightValues[i]);
				}
				try {
					weights.writeAttributeWeights(outputFile, Encoding.getEncoding(operator.getRoot()));
				} catch (IOException e) {
					throw new UserError(operator, e, 303, new Object[] { outputFile, e.getMessage() });
				}
			}
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:SaveIntermediateWeights.java

示例3: operate

import com.rapidminer.operator.features.Individual; //导入方法依赖的package包/类
@Override
public List<Individual> operate(Individual individual) {
	double[] weights = individual.getWeights();

	List<Individual> l = new LinkedList<Individual>();
	for (int i = 0; i < weights.length; i++) {
		if (weights[i] > 0) {
			double[] newWeights = new double[weights.length];
			System.arraycopy(weights, 0, newWeights, 0, weights.length);
			newWeights[i] = 0;
			Individual newIndividual = new Individual(newWeights);
			if (newIndividual.getNumberOfUsedAttributes() > 0)
				l.add(newIndividual);
		}
	}
	return l;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:18,代码来源:BackwardElimination.java

示例4: operate

import com.rapidminer.operator.features.Individual; //导入方法依赖的package包/类
public void operate(Population pop) throws Exception {
	Individual bestIndividual = pop.getBestIndividualEver();
	if (bestIndividual != null) {
		File outputFile = operator.getParameterAsFile(AbstractGeneticAlgorithm.PARAMETER_INTERMEDIATE_WEIGHTS_FILE, true);
		if (outputFile != null) {
			AttributeWeightsWriter writer = OperatorService.createOperator(AttributeWeightsWriter.class);
			writer.setParameter(AttributeWeightsWriter.PARAMETER_ATTRIBUTE_WEIGHTS_FILE, outputFile.getAbsolutePath());

			double[] weightValues = bestIndividual.getWeights();
			if (weightValues.length == attributeNames.length) {
				AttributeWeights weights = new AttributeWeights();
				for (int i = 0; i < weightValues.length; i++) {
					weights.setWeight(attributeNames[i], weightValues[i]);
				}
				writer.write(weights); 
			}
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:20,代码来源:SaveIntermediateWeights.java

示例5: operate

import com.rapidminer.operator.features.Individual; //导入方法依赖的package包/类
@Override
public List<Individual> operate(Individual individual) {
	double[] weights = individual.getWeights();
	List<Individual> l = new LinkedList<Individual>();
	for (int i = 0; i < weights.length; i++) {
		if (weights[i] == 0) {
			double[] newWeights = new double[weights.length];
			System.arraycopy(weights, 0, newWeights, 0, weights.length);
			newWeights[i] = 1.0d;
			l.add(new Individual(newWeights));
		}
	}
	return l;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:ForwardSelection.java

示例6: getValueAt

import com.rapidminer.operator.features.Individual; //导入方法依赖的package包/类
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
	switch (columnIndex) {
		case 0:
			return (rowIndex + 1);
		case 1:
			Individual individual = population.get(rowIndex);
			return individual.getNumberOfUsedAttributes();
		case 2:
			individual = population.get(rowIndex);
			double[] weights = individual.getWeights();
			StringBuffer names = new StringBuffer();
			boolean first = true;
			for (int w = 0; w < weights.length; w++) {
				if (weights[w] > 0.0) {
					if (!first) {
						names.append(", ");
					}
					names.append(attributeNames[w]);
					first = false;
				}
			}
			return names.toString();
		default:
			int perfIndex = columnIndex - columnOffset;
			individual = population.get(rowIndex);
			PerformanceCriterion criterion = individual.getPerformance().getCriterion(perfIndex);
			return criterion.getAverage();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:31,代码来源:IndividualSelectorTableModel.java

示例7: getValueAt

import com.rapidminer.operator.features.Individual; //导入方法依赖的package包/类
public Object getValueAt(int rowIndex, int columnIndex) {
	switch (columnIndex) {
	case 0:
		return (rowIndex + 1);
	case 1:
		Individual individual = population.get(rowIndex);
		return individual.getNumberOfUsedAttributes();
	case 2:
		individual = population.get(rowIndex);
		double[] weights = individual.getWeights();
		StringBuffer names = new StringBuffer();
		boolean first = true;
		for (int w = 0; w < weights.length; w++) {
			if (weights[w] > 0.0) {
				if (!first) {
					names.append(", ");
				}
				names.append(attributeNames[w]);
				first = false;
			}
		}
		return names.toString();
	default:
		int perfIndex = columnIndex - columnOffset;
		individual = population.get(rowIndex);
		PerformanceCriterion criterion = individual.getPerformance().getCriterion(perfIndex);
		return criterion.getAverage();
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:30,代码来源:IndividualSelectorTableModel.java


注:本文中的com.rapidminer.operator.features.Individual.getWeights方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。