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


Java DataTable.getColumnName方法代码示例

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


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

示例1: DataTableColumn

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
/**
 * @brief Creates a new {@link DataTableColumn}.
 * 
 *        name and value type are automatically initialized from the specified column in
 *        dataTable. The DataTableColumn does not keep a reference to dataTable.
 */
public DataTableColumn(DataTable dataTable, int columnIdx) {
	if (columnIdx >= 0 && columnIdx < dataTable.getColumnNumber()) {
		this.columnName = dataTable.getColumnName(columnIdx);
		if (dataTable.isDateTime(columnIdx)) {
			this.valueType = ValueType.DATE_TIME;
		} else if (dataTable.isNominal(columnIdx)) {
			this.valueType = ValueType.NOMINAL;
		} else if (dataTable.isNumerical(columnIdx)) {
			this.valueType = ValueType.NUMERICAL;
		} else {
			this.valueType = ValueType.INVALID;
		}
	} else {
		this.columnName = null;
		this.valueType = ValueType.INVALID;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:24,代码来源:DataTableColumn.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: drawNominalLegend

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
private void drawNominalLegend(Graphics graphics, DataTable table, int legendColumn, int xOffset, int alpha) {
	Graphics2D g = (Graphics2D) graphics.create();
	g.translate(xOffset, 0);

	// painting label name
	String legendName = table.getColumnName(legendColumn);
	g.drawString(legendName, MARGIN, 15);
	Rectangle2D legendNameBounds = LABEL_FONT.getStringBounds(legendName, g.getFontRenderContext());
	g.translate(legendNameBounds.getWidth(), 0);

	// painting values
	int numberOfValues = table.getNumberOfValues(legendColumn);
	int currentX = MARGIN;

	for (int i = 0; i < numberOfValues; i++) {
		if (currentX > getWidth()) {
			break;
		}
		String nominalValue = table.mapIndex(legendColumn, i);
		if (nominalValue.length() > 16) {
			nominalValue = nominalValue.substring(0, 16) + "...";
		}
		Shape colorBullet = new Ellipse2D.Double(currentX, 7, 7.0d, 7.0d);
		Color color = getColorProvider().getPointColor((double) i / (double) (numberOfValues - 1), alpha);
		g.setColor(color);
		g.fill(colorBullet);
		g.setColor(Color.black);
		g.draw(colorBullet);
		currentX += 12;
		g.drawString(nominalValue, currentX, 15);
		Rectangle2D stringBounds = LABEL_FONT.getStringBounds(nominalValue, g.getFontRenderContext());
		currentX += stringBounds.getWidth() + 15;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:35,代码来源:PlotterAdapter.java

示例4: doWork

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
	DataTable table = null;
	if (isParameterSet(PARAMETER_LOG_NAME)) {
		String dataTableName = getParameterAsString(PARAMETER_LOG_NAME);
		table = getProcess().getDataTable(dataTableName);
	} else {
		if (getProcess().getDataTables().size() > 0) {
			table = getProcess().getDataTables().iterator().next();
			logNote("No log name was specified, using first data table found...");
		}
	}

	// check
	if (table == null) {
		throw new UserError(this, 939);
	}

	// create attributes
	List<Attribute> attributes = new ArrayList<Attribute>();
	for (int i = 0; i < table.getNumberOfColumns(); i++) {
		String name = table.getColumnName(i);
		if (table.isDate(i)) {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.DATE));
		} else if (table.isDateTime(i)) {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.DATE_TIME));
		} else if (table.isNumerical(i)) {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.REAL));
		} else {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.NOMINAL));
		}
	}

	// create table
	MemoryExampleTable exampleTable = new MemoryExampleTable(attributes);
	for (int r = 0; r < table.getNumberOfRows(); r++) {
		DataTableRow row = table.getRow(r);
		double[] data = new double[attributes.size()];
		for (int i = 0; i < table.getNumberOfColumns(); i++) {
			if (table.isDate(i)) {
				data[i] = row.getValue(i);
			} else if (table.isDateTime(i)) {
				data[i] = row.getValue(i);
			} else if (table.isNumerical(i)) {
				data[i] = row.getValue(i);
			} else {
				Attribute attribute = attributes.get(i);
				String value = table.getValueAsString(row, i);
				data[i] = attribute.getMapping().mapString(value);
			}
		}
		exampleTable.addDataRow(new DoubleArrayDataRow(data));
	}

	// create and return example set
	exampleSetOutput.deliver(exampleTable.createExampleSet());
	dummyPorts.passDataThrough();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:59,代码来源:ProcessLog2ExampleSet.java

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