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


Java DataTable.getColumnIndex方法代码示例

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


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

示例1: HeuristicPlotterConfigurator

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
public HeuristicPlotterConfigurator(PlotterConfigurationModel plotterSettings, DataTable dataTable) {

		List<String> columnNames = new LinkedList<>(Arrays.asList(dataTable.getColumnNames()));
		Iterator<String> iterator = columnNames.iterator();

		// iterate over columns and remove all columns from list that have too many values
		while (iterator.hasNext()) {
			String columnName = iterator.next();
			int columnIndex = dataTable.getColumnIndex(columnName);

			// nominal columns with more than MAX_NOMINAL_VALUES will be removed
			if (columnIndex != -1 && dataTable.isNominal(columnIndex)
					&& dataTable.getNumberOfValues(columnIndex) > MAX_NOMINAL_VALUES) {
				iterator.remove();
			}
		}

		this.columnNames = columnNames.toArray(new String[columnNames.size()]);
		this.settings = plotterSettings;
		this.categoryToColumnListMap = new HashMap<>();
		populateCategoryMap(dataTable);
	}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:HeuristicPlotterConfigurator.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: getColumnIndex

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
/**
 * Finds the column index for the column named columnName in dataTable, checks if that column in
 * the data table is compatible with to settings valueType, and updates this.columnIdx.
 * 
 * If the column does not exist or is not compatible, the columnIdx is set to -1.
 */
public static int getColumnIndex(DataTable dataTable, String columnName, ValueType valueType) {
	int columnIdx = dataTable.getColumnIndex(columnName);
	if (columnIdx >= 0) {
		// check value type
		switch (valueType) {
			case NOMINAL:
				if (!dataTable.isNominal(columnIdx)) {
					columnIdx = -1;
				}
				break;
			case NUMERICAL:
				if (!dataTable.isNumerical(columnIdx)) {
					columnIdx = -1;
				}
				break;
			case DATE_TIME:
				if (!dataTable.isDateTime(columnIdx)) {
					columnIdx = -1;
				}
				break;
			case INVALID:
				// do nothing
				break;
		}
	}
	return columnIdx;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:34,代码来源:DataTableColumn.java

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