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


Java DataTable.mapString方法代码示例

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


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

示例1: createDataTable

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
public DataTable createDataTable() {
	DataTable dataTable = new SimpleDataTable("Attribute Weights", new String[] { "attribute", "weight" });
	for (Map.Entry<String, AttributeWeight> entry : weightMap.entrySet()) {
		String attName = entry.getKey();
		AttributeWeight attWeight = entry.getValue();
		double index = dataTable.mapString(0, attName);
		double weightValue = attWeight.getWeight();
		double[] data = new double[] { index, weightValue };
		dataTable.add(new SimpleDataTableRow(data, attName));
	}
	return dataTable;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:13,代码来源:AttributeWeights.java

示例2: getPointBorderColor

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
public Color getPointBorderColor(DataTable table, DataTableRow row, int column) {
	Color result = Color.BLACK;
	if (table.isNominal(column)) { // nominal --> try to find compare column
		double colorValue = row.getValue(column);
		if (!Double.isNaN(colorValue)) {
			int colorIndex = (int) colorValue;
			String columnName = table.getColumnName(column);
			int startParIndex = columnName.indexOf("(") + 1;
			if (startParIndex >= 0) {
				int endParIndex = columnName.indexOf(")", startParIndex);
				if (endParIndex >= 0) {
					String otherColumnName = columnName.substring(startParIndex, endParIndex);
					int otherColumnIndex = table.getColumnIndex(otherColumnName);
					if (otherColumnIndex >= 0) {
						if (table.isNominal(otherColumnIndex)) {
							double compareValue = row.getValue(otherColumnIndex);
							if (!Double.isNaN(compareValue)) {
								int compareIndex = (int) compareValue;
								String compareString = table.mapIndex(otherColumnIndex, compareIndex);
								compareIndex = table.mapString(column, compareString);
								if (colorIndex != compareIndex) {
									// both values are different --> change color
									result = Color.RED;
								}
							}
						}
					}
				}
			}
		}
	}
	if (reduceBrightness) {
		return reduceColorBrightness(result);
	} else {
		return result;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:38,代码来源:ColorProvider.java

示例3: getPointColorValue

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
/**
 * Helper methods which can be used to deliver a value for the point color. For nominal values
 * with two classes, this method tries to search another column with a name xxx(name) and
 * changes the color a bit to the opponent color if the values are not the same. This might be
 * nice for example in case of a predicted value and a real value.
 */
public double getPointColorValue(DataTable table, DataTableRow row, int column, double min, double max) {
	double colorValue = row.getValue(column);
	if (max == min && table.isNominal(column)) {
		return colorValue / (table.getNumberOfValues(column) - 1);
	} else {
		double normalized = (colorValue - min) / (max - min);
		if (!Double.isNaN(colorValue)) {
			if (table.isNominal(column) && table.getNumberOfValues(column) == 2) {
				String columnName = table.getColumnName(column);
				int startParIndex = columnName.indexOf("(") + 1;
				if (startParIndex >= 0) {
					int endParIndex = columnName.indexOf(")", startParIndex);
					if (endParIndex >= 0) {
						String otherColumnName = columnName.substring(startParIndex, endParIndex);
						int otherColumnIndex = table.getColumnIndex(otherColumnName);
						if (otherColumnIndex >= 0) {
							if (table.isNominal(otherColumnIndex)) {
								double compareValue = row.getValue(otherColumnIndex);
								if (!Double.isNaN(compareValue)) {
									int compareIndex = (int) compareValue;
									String compareString = table.mapIndex(otherColumnIndex, compareIndex);
									compareIndex = table.mapString(column, compareString);
									if (colorValue != compareIndex) {
										// both values are different --> change color
										if (normalized > 0.8) {
											normalized = 0.8;
										} else if (normalized < 0.2) {
											normalized = 0.2;
										}
									}
								}
							}
						}
					}
				}
			}
		}
		return normalized;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:47,代码来源:ColorProvider.java


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