本文整理汇总了Java中com.rapidminer.datatable.DataTable类的典型用法代码示例。如果您正苦于以下问题:Java DataTable类的具体用法?Java DataTable怎么用?Java DataTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataTable类属于com.rapidminer.datatable包,在下文中一共展示了DataTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataTable
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
/**
* This method is used to create a {@link DataTable} from this example set. The default
* implementation returns an instance of {@link DataTableExampleSetAdapter}. The given
* IOContainer is used to check if there are compatible attribute weights which would used as
* column weights of the returned table. Subclasses might want to override this method in order
* to allow for other data tables.
*/
public DataTable createDataTable(IOContainer container) {
AttributeWeights weights = null;
if (container != null) {
try {
weights = container.get(AttributeWeights.class);
for (Attribute attribute : getAttributes()) {
double weight = weights.getWeight(attribute.getName());
if (Double.isNaN(weight)) { // not compatible
weights = null;
break;
}
}
} catch (MissingIOObjectException e) {
}
}
return new DataTableExampleSetAdapter(this, weights);
}
示例2: updateDataTables
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
/**
* Update the DataTableViewers. This does not happen on the EDT and is executed asynchronously
* by an {@link UpdateQueue}.
*/
private void updateDataTables() {
final Collection<DataTable> copy = new LinkedList<>(dataTables.values());
// this is time consuming, so execute off EDT
tableUpdateQueue.execute(new Runnable() {
@Override
public void run() {
final Collection<DataTableViewer> viewers = new LinkedList<>();
for (DataTable table : copy) {
viewers.add(new DataTableViewer(table, true, DataTableViewer.PLOT_MODE));
}
installDataTableViewers(viewers);
}
@Override
public String toString() {
return "Update data table list to size " + copy.size();
}
});
}
示例3: 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;
}
}
示例4: PlotConfigurationTree
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
public PlotConfigurationTree(PlotConfiguration plotConfiguration, DataTable dataTable,
DataTableColumnListTransferHandler aTH) {
super();
expandAll();
// forces the tree to ask the nodes for the correct row heights
// must also be invoked after LaF changes...
setRowHeight(0);
getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
setExpandsSelectedPaths(true);
// DnD support
setDragEnabled(true);
setDropMode(DropMode.INSERT);
// Rendering
setShowsRootHandles(false);
setBackground(Colors.WHITE);
setCellRenderer(new PlotConfigurationTreeCellRenderer(aTH));
putClientProperty("JTree.lineStyle", "Horizontal");
createNewTreeModel(plotConfiguration);
}
示例5: getPlotter
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
@Override
public JComponent getPlotter() {
DataTable table = getDataTable();
if (table != null && table.getNumberOfRows() > MAX_NUMBER_OF_ROWS) {
LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.mathplot.SurfacePlot2D.too_many_examples",
new Object[] { table.getNumberOfRows(), MAX_NUMBER_OF_ROWS });
// Display Label with error message because Plot3DPanel can not handle such a lot of
// data points
JLabel label = new JLabel(I18N.getGUILabel("surface3DPlot.too_many_examples", MAX_NUMBER_OF_ROWS));
label.setHorizontalAlignment(SwingConstants.CENTER);
Font originalFont = label.getFont();
label.setFont(originalFont.deriveFont((float) (originalFont.getSize() * 1.25)));
originalFont.deriveFont(new AffineTransform());
return label;
} else {
return super.getPlotter();
}
}
示例6: getAggregatedValueForGroupCell
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
public double getAggregatedValueForGroupCell(SeriesUsageType seriesUsage, GroupCellKey groups) {
DataTable data = getDataTableForGroupCell(groups);
if (data == null) {
return Double.NaN;
}
double[] doubleArray = new double[data.getRowNumber()];
int i = 0;
int columnIdx = getDataTableColumnIdx(seriesUsage);
for (DataTableRow d : data) {
doubleArray[i] = d.getValue(columnIdx);
++i;
}
AggregationFunction aggregationFunction = valueSource.getAggregationFunction(seriesUsage);
double calculate = aggregationFunction.calculate(doubleArray);
if (Double.isInfinite(calculate)) {
calculate = Double.NaN;
}
return calculate;
}
示例7: setDataTable
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
@Override
public void setDataTable(DataTable dataTable) {
super.setDataTable(dataTable);
this.dataTable = dataTable;
// ignore list
DefaultListModel ignoreModel = (DefaultListModel) ignoreList.getModel();
ignoreModel.clear();
for (int i = 0; i < this.dataTable.getNumberOfColumns(); i++) {
if (i == colorColumn) {
continue;
}
ignoreModel.addElement(this.dataTable.getColumnName(i));
}
this.maxWeight = getMaxWeight(dataTable);
repaint();
}
示例8: getVisualizationComponent
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
@Override
public Component getVisualizationComponent(Object renderable, IOContainer ioContainer) {
DataTable dataTable = getDataTable(renderable, ioContainer, true);
if (dataTable != null) {
DataTableViewerTable resultTable = new DataTableViewerTable(dataTable, isSortable(), isColumnMovable(),
isAutoresize());
resultTable.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);
resultTable.setRowHighlighting(true);
resultTable.setCellColorProvider(getCellColorProvider(resultTable, renderable));
ExtendedJScrollPane scrollPane = new ExtendedJScrollPane(resultTable);
scrollPane.setBorder(BorderFactory.createEmptyBorder(42, 10, 15, 10));
scrollPane.setBackground(Colors.WHITE);
scrollPane.getViewport().setBackground(Colors.WHITE);
JPanel component = new JPanel(new BorderLayout());
component.add(scrollPane, BorderLayout.CENTER);
return component;
} else {
return ResultDisplayTools.createErrorComponent("No visualization possible for table.");
}
}
示例9: loadFromXML
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
public static PlotterConfigurationModel loadFromXML(Node node, DataTable table,
HashMap<String, Class<? extends Plotter>> availablePlotters) {
if (node instanceof Element) {
Element parameters = (Element) node;
if (parameters.getNodeName().equals("plottersettings")) {
String plotterName = parameters.getAttribute("plotter");
PlotterConfigurationModel settings = new PlotterConfigurationModel(availablePlotters, plotterName, table);
// now searching all child elements for settings
NodeList list = parameters.getElementsByTagName("setting");
for (int i = 0; i < list.getLength(); i++) {
Node settingsNode = list.item(i);
if (settingsNode instanceof Element) {
Element parameter = (Element) settingsNode;
settings.setParameterAsString(parameter.getAttribute("key"), parameter.getAttribute("value"));
}
}
return settings;
}
}
return null;
}
示例10: getNewDePivotedPlotInstance
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
/**
*
* Returns a new PlotInstance with a dePivoted data table of the original data table. If the
* transformation could not be achieved, <code>null</code> is returned. If no plot config for
* the new PlotInstance is provided a PlotConfiguration with an invalid domain dimension will be
* created.
*
* @param nominalToNumericalAttributeList
*/
private PlotInstance getNewDePivotedPlotInstance(PlotConfiguration newPlotConfig,
Collection<String> excludedNumericalAttributeList, Collection<String> selectedNominalToNumericAttributesList) {
PlotInstance plotInstance;
DataTable transformed = getDePivotedDataTable(excludedNumericalAttributeList, selectedNominalToNumericAttributesList);
if (transformed == null) {
return null;
}
if (newPlotConfig == null) {
newPlotConfig = new PlotConfiguration(new DataTableColumn("-Empty-", ValueType.INVALID));
}
plotInstance = new PlotInstance(newPlotConfig, transformed);
return plotInstance;
}
示例11: 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;
}
示例12: PlotInstance
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
public PlotInstance(PlotConfiguration plotConfiguration, DataTable dataTable) {
this.masterOfDesaster = new MasterOfDesaster();
this.masterPlotConfiguration = plotConfiguration;
// THIS ENSURES THAT THE PLOT INSTANCE GETS TO KNOW THE CURRENT WORKING COPY AS FIRST
// LISTENER
this.masterPlotConfiguration.addPlotConfigurationListener(this, true); // NEVER EVER REMOVE
// THIS.
currentPlotConfigurationClone = plotConfiguration.clone();
plotData = new PlotData(this, dataTable);
}
示例13: clearDataTable
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
/** Clears a single data table, i.e. removes all entries. */
public void clearDataTable(final String name) {
DataTable table = getDataTable(name);
if (table != null) {
if (table instanceof SimpleDataTable) {
((SimpleDataTable) table).clear();
}
}
}
示例14: getAllDataTableValues
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
public static List<Double> getAllDataTableValues(DataTable table, int columnIdx) {
List<Double> values = new LinkedList<Double>();
for (DataTableRow row : table) {
values.add(row.getValue(columnIdx));
}
return values;
}
示例15: createWeightsTable
import com.rapidminer.datatable.DataTable; //导入依赖的package包/类
private DataTable createWeightsTable() {
SimpleDataTable weightTable = new SimpleDataTable("Hyper Weights", new String[] { "Attribute", "Weight" });
for (int j = 0; j < w.length; j++) {
int nameIndex = weightTable.mapString(0, this.coefficientNames[j]);
weightTable.add(new SimpleDataTableRow(new double[] { nameIndex, w[j] }));
}
return weightTable;
}