本文整理汇总了Java中com.rapidminer.parameter.ParameterTypeEnumeration.transformString2Enumeration方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterTypeEnumeration.transformString2Enumeration方法的具体用法?Java ParameterTypeEnumeration.transformString2Enumeration怎么用?Java ParameterTypeEnumeration.transformString2Enumeration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rapidminer.parameter.ParameterTypeEnumeration
的用法示例。
在下文中一共展示了ParameterTypeEnumeration.transformString2Enumeration方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modifiyMetaData
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
protected ExampleSetMetaData modifiyMetaData(ExampleSetMetaData metaData, int outputIndex)
throws UndefinedParameterError {
if (metaData.getNumberOfExamples().isKnown()) {
String[] ratioList = ParameterTypeEnumeration
.transformString2Enumeration(getParameterAsString(PARAMETER_PARTITIONS));
double[] ratios = new double[ratioList.length];
if (outputIndex < ratios.length) {
int i = 0;
double sum = 0;
for (String entry : ratioList) {
ratios[i] = Double.valueOf(entry);
sum += ratios[i];
i++;
}
metaData.setNumberOfExamples((int) (ratios[outputIndex] / sum * metaData.getNumberOfExamples().getValue()));
for (AttributeMetaData amd : metaData.getAllAttributes()) {
amd.getNumberOfMissingValues().reduceByUnknownAmount();
}
} else {
return null;
}
}
return metaData;
}
示例2: modifiyMetaData
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
protected ExampleSetMetaData modifiyMetaData(ExampleSetMetaData metaData, int outputIndex) throws UndefinedParameterError {
if (metaData.getNumberOfExamples().isKnown()) {
String[] ratioList = ParameterTypeEnumeration.transformString2Enumeration(getParameterAsString(PARAMETER_PARTITIONS));
double[] ratios = new double[ratioList.length];
if (outputIndex < ratios.length) {
int i = 0;
double sum = 0;
for (String entry : ratioList) {
ratios[i] = Double.valueOf(entry);
sum += ratios[i];
i++;
}
metaData.setNumberOfExamples((int)(ratios[outputIndex] / sum * metaData.getNumberOfExamples().getValue()));
for (AttributeMetaData amd: metaData.getAllAttributes()) {
amd.getNumberOfMissingValues().reduceByUnknownAmount();
}
} else
return null;
}
return metaData;
}
示例3: enablePlotColumn
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
public void enablePlotColumn(String column) {
String key = PlotterAdapter.PARAMETER_PLOT_COLUMNS;
String[] oldColumns = ParameterTypeEnumeration.transformString2Enumeration(getParameter(key));
List<String> columns = new LinkedList<>();
columns.addAll(Arrays.asList(oldColumns));
columns.add(column);
setParameterAsString(key, ParameterTypeEnumeration.transformEnumeration2String(columns));
}
示例4: settingChanged
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public void settingChanged(String generalKey, String specificKey, String value) {
if (generalKey.equals(this.generalKey)) {
ListModel listModel = list.getModel();
// searching indices of selected dimensions
String names[] = ParameterTypeEnumeration.transformString2Enumeration(value);
boolean[] selectedDimensions = new boolean[listModel.getSize()];
for (int i = 0; i < names.length; i++) {
String name = names[i].trim();
for (int j = 0; j < listModel.getSize(); j++) {
if (listModel.getElementAt(j).equals(name)) {
selectedDimensions[j] = true;
break;
}
}
}
// switching all differing dimensions
setValueIsAdjusting(true);
for (int i = 0; i < listModel.getSize(); i++) {
if (selectedDimensions[i]) {
addSelectionInterval(i, i);
} else {
removeSelectionInterval(i, i);
}
}
setValueIsAdjusting(false);
}
}
示例5: getTableCellEditorComponent
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int col) {
if (value != null) {
LinkedList<String> values = new LinkedList<String>();
for (String string : ParameterTypeEnumeration.transformString2Enumeration((String) value)) {
values.add(string);
}
this.valuesList = values;
} else {
this.valuesList = new LinkedList<String>();
}
setButtonText();
return button;
}
示例6: read
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public Thresholds read() throws OperatorException {
String[] ratioList = ParameterTypeEnumeration
.transformString2Enumeration(getParameterAsString(PARAMETER_THRESHOLDS));
double[] thresholds = new double[ratioList.length];
for (int i = 0; i < ratioList.length; i++) {
thresholds[i] = Double.valueOf(ratioList[i]);
}
return new Thresholds(thresholds);
}
示例7: settingChanged
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public void settingChanged(String generalKey, String specificKey, String value) {
if (generalKey.equals(this.generalKey)) {
ListModel<String> listModel = list.getModel();
// searching indices of selected dimensions
String names[] = ParameterTypeEnumeration.transformString2Enumeration(value);
boolean[] selectedDimensions = new boolean[listModel.getSize()];
for (int i = 0; i < names.length; i++) {
String name = names[i].trim();
for (int j = 0; j < listModel.getSize(); j++) {
if (listModel.getElementAt(j).equals(name)) {
selectedDimensions[j] = true;
break;
}
}
}
// switching all differing dimensions
setValueIsAdjusting(true);
for (int i = 0; i < listModel.getSize(); i++) {
if (selectedDimensions[i]) {
addSelectionInterval(i, i);
} else {
removeSelectionInterval(i, i);
}
}
setValueIsAdjusting(false);
}
}
示例8: enablePlotColumn
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
public void enablePlotColumn(String column) {
String key = PlotterAdapter.PARAMETER_PLOT_COLUMNS;
String[] oldColumns = ParameterTypeEnumeration.transformString2Enumeration(getParameter(key));
List<String> columns = new LinkedList<String>();
columns.addAll(Arrays.asList(oldColumns));
columns.add(column);
setParameterAsString(key, ParameterTypeEnumeration.transformEnumeration2String(columns));
}
示例9: settingChanged
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public void settingChanged(String generalKey, String specificKey, String value) {
if (generalKey.equals(this.generalKey)) {
ListModel listModel = list.getModel();
// searching indices of selected dimensions
String names[] = ParameterTypeEnumeration.transformString2Enumeration(value);
boolean[] selectedDimensions = new boolean[listModel.getSize()];
for (int i = 0; i < names.length; i++) {
String name = names[i].trim();
for (int j = 0; j < listModel.getSize(); j++) {
if (listModel.getElementAt(j).equals(name)) {
selectedDimensions[j] = true;
break;
}
}
}
// switching all differing dimensions
setValueIsAdjusting(true);
for (int i = 0; i < listModel.getSize(); i++) {
if (selectedDimensions[i])
addSelectionInterval(i, i);
else
removeSelectionInterval(i, i);
}
setValueIsAdjusting(false);
}
}
示例10: getTableCellEditorComponent
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int col) {
if (value != null) {
LinkedList<String> values = new LinkedList<String>();
for (String string: ParameterTypeEnumeration.transformString2Enumeration((String)value)) {
values.add(string);
}
this.valuesList = values;
} else
this.valuesList = new LinkedList<String>();
setButtonText();
return button;
}
示例11: executeStatement
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
public ResultSet executeStatement(String sql, boolean isQuery, Operator parameterHandler, Logger logger) throws SQLException, OperatorException {
checkDatabaseConstraintOnOperator(parameterHandler, this.databaseURL);
ResultSet resultSet = null;
Object statement = null;
try {
if(parameterHandler.getParameterAsBoolean("prepare_statement")) {
PreparedStatement prepared = this.getConnection().prepareStatement(sql);
String[] parameters = ParameterTypeEnumeration.transformString2Enumeration(parameterHandler.getParameterAsString("parameters"));
for(int i = 0; i < parameters.length; ++i) {
String[] argDescription = ParameterTypeTupel.transformString2Tupel(parameters[i]);
String sqlType = argDescription[0];
String replacementValue = argDescription[1];
if("VARCHAR".equals(sqlType)) {
prepared.setString(i + 1, replacementValue);
} else if("REAL".equals(sqlType)) {
try {
prepared.setDouble(i + 1, Double.parseDouble(replacementValue));
} catch (NumberFormatException var21) {
prepared.close();
throw new UserError(parameterHandler, 158, new Object[]{replacementValue, sqlType});
}
} else if("LONG".equals(sqlType)) {
try {
prepared.setLong(i + 1, Long.parseLong(replacementValue));
} catch (NumberFormatException var20) {
prepared.close();
throw new UserError(parameterHandler, 158, new Object[]{replacementValue, sqlType});
}
} else {
if(!"INTEGER".equals(sqlType)) {
prepared.close();
throw new OperatorException("Illegal data type: " + sqlType);
}
try {
prepared.setInt(i + 1, Integer.parseInt(replacementValue));
} catch (NumberFormatException var19) {
prepared.close();
throw new UserError(parameterHandler, 158, new Object[]{replacementValue, sqlType});
}
}
}
if(isQuery) {
resultSet = this.executeQuery(prepared, parameterHandler);
} else {
this.execute(prepared, parameterHandler);
}
statement = prepared;
} else {
logger.info("Executing query: \'" + sql + "\'");
statement = this.createStatement(false);
if(isQuery) {
resultSet = this.executeQuery((Statement)statement, parameterHandler, sql);
} else {
this.execute((Statement)statement, parameterHandler, sql);
}
}
} finally {
logger.fine("Query executed.");
if(!isQuery && statement != null) {
((Statement)statement).close();
}
}
return resultSet;
}
示例12: doWork
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
Attribute predictedLabel = exampleSet.getAttributes().getPredictedLabel();
if (predictedLabel == null) {
throw new UserError(this, 107);
}
Attribute label = exampleSet.getAttributes().getLabel();
if (label != null) {
if (label.isNominal()) {
double[][] costMatrix = getParameterAsMatrix(PARAMETER_COST_MATRIX);
// build label ordering map
Map<String, Integer> classOrderMap = null;
if (isParameterSet(PARAMETER_CLASS_DEFINITION)) {
String[] enumeratedValues = ParameterTypeEnumeration
.transformString2Enumeration(getParameterAsString(PARAMETER_CLASS_DEFINITION));
if (enumeratedValues.length > 0) {
classOrderMap = new HashMap<String, Integer>();
int i = 0;
for (String className : enumeratedValues) {
classOrderMap.put(className, i);
i++;
}
// check whether each possible label occurred once
for (String value : label.getMapping().getValues()) {
if (!classOrderMap.containsKey(value)) {
throw new UserError(this, "performance_costs.class_order_definition_misses_value", value);
}
}
// check whether map is of same size than costMatrix
if (costMatrix.length != classOrderMap.size()) {
throw new UserError(this, "performance_costs.cost_matrix_with_wrong_dimension",
costMatrix.length, classOrderMap.size());
}
}
}
MeasuredPerformance criterion = new ClassificationCostCriterion(costMatrix, classOrderMap, label,
predictedLabel);
PerformanceVector performance = new PerformanceVector();
performance.addCriterion(criterion);
// now measuring costs
criterion.startCounting(exampleSet, false);
for (Example example : exampleSet) {
criterion.countExample(example);
}
// setting logging value
lastCosts = criterion.getAverage();
exampleSetOutput.deliver(exampleSet);
performanceOutput.deliver(performance);
} else {
throw new UserError(this, 101, "CostEvaluator", label.getName());
}
} else {
throw new UserError(this, 105);
}
}
示例13: doWork
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
Tools.hasNominalLabels(exampleSet, getOperatorClassName());
Attribute predictedLabel = exampleSet.getAttributes().getPredictedLabel();
if (predictedLabel == null) {
throw new UserError(this, 107);
}
Attribute label = exampleSet.getAttributes().getLabel();
double[][] costMatrix = getParameterAsMatrix(PARAMETER_COST_MATRIX);
// build label ordering map
Map<String, Integer> classOrderMap = null;
if (isParameterSet(PARAMETER_CLASS_DEFINITION)) {
String[] enumeratedValues = ParameterTypeEnumeration
.transformString2Enumeration(getParameterAsString(PARAMETER_CLASS_DEFINITION));
if (enumeratedValues.length > 0) {
classOrderMap = new HashMap<String, Integer>();
int i = 0;
for (String className : enumeratedValues) {
classOrderMap.put(className, i);
i++;
}
// check whether each possible label occurred once
for (String value : label.getMapping().getValues()) {
if (!classOrderMap.containsKey(value)) {
throw new UserError(this, "performance_costs.class_order_definition_misses_value", value);
}
}
// check whether map is of same size than costMatrix
if (costMatrix.length != classOrderMap.size()) {
throw new UserError(this, "performance_costs.cost_matrix_with_wrong_dimension", costMatrix.length,
classOrderMap.size());
}
}
}
MeasuredPerformance criterion = new ClassificationCostCriterion(costMatrix, classOrderMap, label, predictedLabel);
PerformanceVector performance = new PerformanceVector();
performance.addCriterion(criterion);
// now measuring costs
criterion.startCounting(exampleSet, false);
for (Example example : exampleSet) {
criterion.countExample(example);
}
// setting logging value
lastCosts = criterion.getAverage();
exampleSetOutput.deliver(exampleSet);
performanceOutput.deliver(performance);
}
示例14: doWork
import com.rapidminer.parameter.ParameterTypeEnumeration; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
Attribute predictedLabel = exampleSet.getAttributes().getPredictedLabel();
if(predictedLabel == null){
throw new UserError(this, 107);
}
Attribute label = exampleSet.getAttributes().getLabel();
if (label != null) {
if (label.isNominal()) {
double[][] costMatrix = getParameterAsMatrix(PARAMETER_COST_MATRIX);
// build label ordering map
Map<String, Integer> classOrderMap = null;
if (isParameterSet(PARAMETER_CLASS_DEFINITION)) {
String[] enumeratedValues = ParameterTypeEnumeration.transformString2Enumeration(getParameterAsString(PARAMETER_CLASS_DEFINITION));
if (enumeratedValues.length > 0) {
classOrderMap = new HashMap<String, Integer>();
int i = 0;
for (String className : enumeratedValues) {
classOrderMap.put(className, i);
i++;
}
// check whether each possible label occurred once
for (String value : label.getMapping().getValues()) {
if (!classOrderMap.containsKey(value)) {
throw new UserError(this, "performance_costs.class_order_definition_misses_value", value);
}
}
// check whether map is of same size than costMatrix
if (costMatrix.length != classOrderMap.size())
throw new UserError(this, "performance_costs.cost_matrix_with_wrong_dimension", costMatrix.length, classOrderMap.size());
}
}
MeasuredPerformance criterion = new ClassificationCostCriterion(costMatrix, classOrderMap, label, predictedLabel);
PerformanceVector performance = new PerformanceVector();
performance.addCriterion(criterion);
// now measuring costs
criterion.startCounting(exampleSet, false);
for (Example example : exampleSet) {
criterion.countExample(example);
}
// setting logging value
lastCosts = criterion.getAverage();
exampleSetOutput.deliver(exampleSet);
performanceOutput.deliver(performance);
} else {
throw new UserError(this, 101, "CostEvaluator", label.getName());
}
} else {
throw new UserError(this, 105);
}
}