本文整理汇总了Java中com.rapidminer.gui.plotter.ExamplePlotterPoint.setCurrentPertubatedX方法的典型用法代码示例。如果您正苦于以下问题:Java ExamplePlotterPoint.setCurrentPertubatedX方法的具体用法?Java ExamplePlotterPoint.setCurrentPertubatedX怎么用?Java ExamplePlotterPoint.setCurrentPertubatedX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rapidminer.gui.plotter.ExamplePlotterPoint
的用法示例。
在下文中一共展示了ExamplePlotterPoint.setCurrentPertubatedX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawPoints
import com.rapidminer.gui.plotter.ExamplePlotterPoint; //导入方法依赖的package包/类
protected void drawPoints(Graphics2D g) {
int pixWidth = getWidth() - 2 * MARGIN;
int pixHeight = getHeight() - 2 * MARGIN;
// painting data points
if (colorColumn >= 0) {
Iterator<DataTableRow> iterator = dataTable.iterator();
// Finding Scalevalue for Color Column
double minColorValue = Double.POSITIVE_INFINITY;
double maxColorValue = Double.NEGATIVE_INFINITY;
while (iterator.hasNext()) {
double value = iterator.next().getValue(colorColumn);
minColorValue = MathFunctions.robustMin(minColorValue, value);
maxColorValue = MathFunctions.robustMax(maxColorValue, value);
}
// remember point positions
if (!examplesApplied) {
int[][] exampleCount = new int[dimensions[0]][dimensions[1]];
exampleCoordinates.clear();
iterator = dataTable.iterator();
int index = 0;
while (iterator.hasNext()) {
DataTableRow row = iterator.next();
// deleting special attributes of a row (ID, Class)
double[] example = getDoubleArrayFromRow(row, dataTable);
int[] coords = net.apply(example);
exampleCoordinates.add(new ExamplePlotterPoint(index, coords[0], coords[1]));
exampleCount[coords[0]][coords[1]]++;
index++;
}
examplesApplied = true;
// painting if already applied
}
// draw points
double fieldWidth = pixWidth / (double) dimensions[0];
double fieldHeight = pixHeight / (double) dimensions[1];
Iterator<ExamplePlotterPoint> exampleIterator = exampleCoordinates.iterator();
RandomGenerator random = RandomGenerator.getRandomGenerator(true, 2001);
ColorProvider colorProvider = getColorProvider();
while (exampleIterator.hasNext()) {
ExamplePlotterPoint point = exampleIterator.next();
double color = 1.0d;
Color borderColor = Color.BLACK;
if (coloredPoints) {
color = colorProvider.getPointColorValue(this.dataTable, dataTable.getRow(point.getDataTableIndex()),
colorColumn, minColorValue, maxColorValue);
borderColor = colorProvider.getPointBorderColor(this.dataTable,
dataTable.getRow(point.getDataTableIndex()), colorColumn);
}
double pertX = 0.0d;
double pertY = 0.0d;
if (jitterAmount > 0) {
pertX = random.nextDoubleInRange(-fieldWidth / 2.0d, fieldWidth / 2.0d) * (jitterAmount / 50.0d);
pertY = random.nextDoubleInRange(-fieldHeight / 2.0d, fieldHeight / 2.0d) * (jitterAmount / 50.0d);
}
point.setCurrentPertubatedX((int) (MARGIN + pertX + point.getX() * fieldWidth + fieldWidth / 2.0d));
point.setCurrentPertubatedY((int) (MARGIN + pertY + point.getY() * fieldHeight + fieldHeight / 2.0d));
drawPoint(g, point.getCurrentPertubatedX(), point.getCurrentPertubatedY(),
colorProvider.getPointColor(color), borderColor);
}
}
}
示例2: drawPoints
import com.rapidminer.gui.plotter.ExamplePlotterPoint; //导入方法依赖的package包/类
protected void drawPoints(Graphics2D g) {
int pixWidth = getWidth() - 2 * MARGIN;
int pixHeight = getHeight() - 2 * MARGIN;
// painting data points
if (colorColumn >= 0) {
Iterator iterator = dataTable.iterator();
// Finding Scalevalue for Color Column
double minColorValue = Double.POSITIVE_INFINITY;
double maxColorValue = Double.NEGATIVE_INFINITY;
while (iterator.hasNext()) {
double value = ((DataTableRow) iterator.next()).getValue(colorColumn);
minColorValue = MathFunctions.robustMin(minColorValue, value);
maxColorValue = MathFunctions.robustMax(maxColorValue, value);
}
// remember point positions
if (!examplesApplied) {
int[][] exampleCount = new int[dimensions[0]][dimensions[1]];
exampleCoordinates.clear();
iterator = dataTable.iterator();
int index = 0;
while (iterator.hasNext()) {
DataTableRow row = (DataTableRow) iterator.next();
// deleting special attributes of a row (ID, Class)
double[] example = getDoubleArrayFromRow(row, dataTable);
int[] coords = net.apply(example);
exampleCoordinates.add(new ExamplePlotterPoint(index, coords[0], coords[1]));
exampleCount[coords[0]][coords[1]]++;
index++;
}
examplesApplied = true;
// painting if already applied
}
// draw points
double fieldWidth = pixWidth / (double)dimensions[0];
double fieldHeight = pixHeight / (double)dimensions[1];
Iterator<ExamplePlotterPoint> exampleIterator = exampleCoordinates.iterator();
RandomGenerator random = RandomGenerator.getRandomGenerator(true, 2001);
ColorProvider colorProvider = getColorProvider();
while (exampleIterator.hasNext()) {
ExamplePlotterPoint point = exampleIterator.next();
double color = 1.0d;
Color borderColor = Color.BLACK;
if (coloredPoints) {
color = colorProvider.getPointColorValue(this.dataTable, dataTable.getRow(point.getDataTableIndex()), colorColumn, minColorValue, maxColorValue);
borderColor = colorProvider.getPointBorderColor(this.dataTable, dataTable.getRow(point.getDataTableIndex()), colorColumn);
}
double pertX = 0.0d;
double pertY = 0.0d;
if (jitterAmount > 0) {
pertX = random.nextDoubleInRange(-fieldWidth / 2.0d, fieldWidth / 2.0d) * (jitterAmount / 50.0d);
pertY = random.nextDoubleInRange(-fieldHeight / 2.0d, fieldHeight / 2.0d) * (jitterAmount / 50.0d);
}
point.setCurrentPertubatedX((int)(MARGIN + pertX + point.getX() * fieldWidth + fieldWidth / 2.0d));
point.setCurrentPertubatedY((int)(MARGIN + pertY + point.getY() * fieldHeight + fieldHeight / 2.0d));
drawPoint(g, point.getCurrentPertubatedX(), point.getCurrentPertubatedY(), colorProvider.getPointColor(color), borderColor);
}
}
}