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