本文整理汇总了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);
}
示例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;
}
}
示例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;
}
示例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;
}
}