Commit fd23a4b8 authored by lafabregue's avatar lafabregue

integration of cluster constraints

parent 645e82ae
No preview for this file type
......@@ -592,6 +592,7 @@ public class MainFrame extends JFrame {
}
});
ArffMenu.add(menuItemArff);
menuItemRaw = new JMenuItem("RawImage to Arff"); //$NON-NLS-1$
menuItemRaw.addActionListener(new ActionListener() {
@Override
......@@ -600,6 +601,7 @@ public class MainFrame extends JFrame {
}
});
ArffMenu.add(menuItemRaw);
menuItemLoadArff = new JMenuItem(Messages.getString("MainFrame.34")); //$NON-NLS-1$
menuItemLoadArff.addActionListener(new ActionListener() {
@Override
......@@ -618,6 +620,24 @@ public class MainFrame extends JFrame {
});
ArffMenu.add(menuItemArffImage);
menuItemArffData = new JMenuItem(Messages.getString("MainFrame.303")); //$NON-NLS-1$
menuItemArffData.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
toolsMenuDataToArff();
}
});
ArffMenu.add(menuItemArffData);
menuItemLoadArffToData = new JMenuItem(Messages.getString("MainFrame.302")); //$NON-NLS-1$
menuItemLoadArffToData.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
toolsMenuArffToData();
}
});
ArffMenu.add(menuItemLoadArffToData);
menuBar.add(ArffMenu);
// Preprocessing
......@@ -982,6 +1002,10 @@ public class MainFrame extends JFrame {
private Boolean actionRaw;
private JMenuItem menuItemLoadArff;
private Boolean actionLoadArff;
private JMenuItem menuItemLoadArffToData;
private Boolean actionLoadArffToData;
private JMenuItem menuItemArffData;
private Boolean actionArffData;
private JMenuItem menuItemArffImage;
private Boolean actionArffImage;
private JMenuItem menuItemVegetation;
......@@ -1070,6 +1094,8 @@ public class MainFrame extends JFrame {
this.actionConfig = true;
this.actionHelp = true;
this.actionLoadArff = true;
this.actionLoadArffToData = true;
this.actionArffData = true;
this.actionNew = true;
this.actionOpen = true;
this.actionOpenRes = true;
......@@ -1160,6 +1186,8 @@ public class MainFrame extends JFrame {
menuItemRaw.setEnabled(this.actionRaw);
menuItemLoadArff.setEnabled(this.actionLoadArff);
menuItemArffImage.setEnabled(this.actionArffImage);
menuItemArffData.setEnabled(this.actionArffData);
menuItemLoadArffToData.setEnabled(this.actionLoadArffToData);
menuZoomIn.setEnabled(this.actionZoomIn);
menuZoomOut.setEnabled(this.actionZoomOut);
menuBrightP.setEnabled(this.actionBrightP);
......@@ -2135,8 +2163,7 @@ public class MainFrame extends JFrame {
*/
protected void createConstraints() {
try {
ConstraintsSelectionDialog dialog = new ConstraintsSelectionDialog();
dialog.setImage(this.currentImageSession.getRawImage());
ConstraintsSelectionDialog dialog = new ConstraintsSelectionDialog(this.currentImageSession.getRawImage());
MainFrame.getInstance().getDesktop().addFrame(dialog);
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, Messages.getString("MainFrame.128"), Messages.getString("MainFrame.129"), //$NON-NLS-1$ //$NON-NLS-2$
......@@ -3334,6 +3361,19 @@ public class MainFrame extends JFrame {
arff.toFront();
}
private void toolsMenuArffToData() {
DataToArffDialog dialog = new DataToArffDialog();
this.desktop.add(dialog);
dialog.toFront();
}
private void toolsMenuDataToArff() {
DataToArffDialog dialog = new DataToArffDialog();
this.desktop.add(dialog);
dialog.toFront();
}
private void toolsMenuClustering() throws Exception {
// MainFrame.getInstance().getDesktop().addFrame(ClassificationFrame.getInstance());
if (!ClassificationFrame.isCreated()) {
......
package mustic.gui.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import jcl.data.Data;
import mustic.gui.DataDesktopFrame;
import mustic.gui.MainFrame;
import mustic.utils.dataExchange.DataArffExchange;
/**
* Fenetre permettant de creer des fichier ARFF à partir d'un image
*
*/
public class DataToArffDialog extends JInternalFrame {
private static final long serialVersionUID = 1L;
/** liste des images ouvertes */
private JComboBox<String> comboData = new JComboBox<String>();
/** nombre de divisions */
private JSpinner spinner = new JSpinner();
/** chemin du fichier que l'on va créer */
private JTextField textSave = new JTextField();
private JTextField txtDate;
public DataToArffDialog() {
super();
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel panelData = new JPanel(new GridLayout(4, 2));
panelData.add(new JLabel(Messages.getString("DataToArffDialog.0"))); //$NON-NLS-1$
DataDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDataDesktopFrames();
int nbSession = desktopFrames.length;
for (int i = 0; i < nbSession; i++) {
String name = desktopFrames[i].getDataSession().getTitle();
this.comboData.addItem(name);
}
if (nbSession == 0) {
JOptionPane.showMessageDialog(this, Messages.getString("DataToArffDialog.24"), //$NON-NLS-1$
Messages.getString("DataToArffDialog.23"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
return;
}
this.comboData.setPreferredSize(new Dimension(100, 30));
panelData.add(comboData);
panelData.add(new JLabel(Messages.getString("DataToArffDialog.12"))); //$NON-NLS-1$
JPanel panelSave = new JPanel(new BorderLayout());
JButton buttonBrowse = new JButton(Messages.getString("DataToArffDialog.13")); //$NON-NLS-1$
buttonBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
DataDesktopFrame[] desktopFrames = MainFrame.getInstance()
.getDesktop().getAllDataDesktopFrames();
int nbSessions = desktopFrames.length;
if (nbSessions > 0) {
String name = desktopFrames[comboData.getSelectedIndex()]
.getDataSession().getData().getDataName();
String path = "~/" + name + ".arff"; //$NON-NLS-1$
File f = new File(path);
fileChooser.setSelectedFile(f);
}
int returnVal = fileChooser
.showSaveDialog(DataToArffDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
String path = fileChooser.getSelectedFile().getPath();
textSave.setText(path);
}
}
});
panelSave.add(this.textSave, BorderLayout.CENTER);
panelSave.add(buttonBrowse, BorderLayout.EAST);
panelData.add(panelSave);
txtDate = new JTextField();
DateFormat formatDate=new SimpleDateFormat("ddMMyy");
txtDate.setText(formatDate.format(new Date()));
panelData.add(new JLabel(Messages.getString("DataToArffDialog.15"))); //$NON-NLS-1$
panelData.add(txtDate);
panelData.add(new JLabel(Messages.getString("DataToArffDialog.16"))); //$NON-NLS-1$
JSpinner.NumberEditor spinnerEditor = new JSpinner.NumberEditor(
this.spinner);
this.spinner.setEditor(spinnerEditor);
spinnerEditor.getModel().setMinimum(1);
spinnerEditor.getModel().setMaximum(256);
spinnerEditor.getModel().setStepSize(1);
spinnerEditor.getModel().setValue(10);
panelData.add(this.spinner);
JPanel panelOk = new JPanel();
JButton buttonOk = new JButton(Messages.getString("DataToArffDialog.17")); //$NON-NLS-1$
buttonOk.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
buttonOk_actionPerformed();
}
});
panelOk.add(buttonOk);
mainPanel.add(panelData, BorderLayout.NORTH);
mainPanel.add(panelOk, BorderLayout.SOUTH);
this.setContentPane(mainPanel);
this.setTitle(Messages.getString("DataToArffDialog.18")); //$NON-NLS-1$
this.setSize(350, 175);
this.setResizable(true);
this.setMaximizable(true);
this.setIconifiable(true);
this.setClosable(true);
this.setVisible(true);
}
/**
* lance la création du fichier arff
*/
protected void buttonOk_actionPerformed() {
DataDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDataDesktopFrames();
int nbSessions = desktopFrames.length;
if (nbSessions == 0) {
JOptionPane.showMessageDialog(this,
Messages.getString("DataToArffDialog.19"), Messages.getString("DataToArffDialog.20"), //$NON-NLS-1$ //$NON-NLS-2$
JOptionPane.WARNING_MESSAGE);
this.dispose();
} else if (this.textSave.getText().equals("")) { //$NON-NLS-1$
JOptionPane.showMessageDialog(this, Messages.getString("DataToArffDialog.22"), //$NON-NLS-1$
Messages.getString("DataToArffDialog.23"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
} else {
Data data = desktopFrames[this.comboData.getSelectedIndex()]
.getDataSession().getData();
DataArffExchange.dataToArff(this.textSave.getText(), data);
JOptionPane.showMessageDialog(this,
Messages.getString("DataToArffDialog.44"), Messages.getString("DataToArffDialog.45"), //$NON-NLS-1$ //$NON-NLS-2$
JOptionPane.INFORMATION_MESSAGE);
this.dispose();
}
}
}
......@@ -21,6 +21,7 @@ import javax.swing.JPanel;
import javax.swing.JTextField;
import mustic.gui.DesktopFrame;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.MainFrame;
import mustic.io.RawImage;
......@@ -47,8 +48,8 @@ public class RawImageToArffDialog extends JInternalFrame {
JPanel panelData = new JPanel(new GridLayout(2, 2));
panelData.add(new JLabel(Messages.getString("ImageToArffDialog.0"))); //$NON-NLS-1$
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDesktopFrames();
ImageDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllImageDesktopFrames();
int nbSession = desktopFrames.length;
for (int i = 0; i < nbSession; i++) {
String path = desktopFrames[i].getImageSession().getRawImage()
......@@ -76,8 +77,8 @@ public class RawImageToArffDialog extends JInternalFrame {
.getString("ImageToArffDialog.6") //$NON-NLS-1$
+ nbSession);
MainFrame.getInstance().openNewFile();
DesktopFrame[] desktopFrames = MainFrame.getInstance()
.getDesktop().getAllDesktopFrames();
ImageDesktopFrame[] desktopFrames = MainFrame.getInstance()
.getDesktop().getAllImageDesktopFrames();
System.out.println(Messages
.getString("ImageToArffDialog.7") //$NON-NLS-1$
+ desktopFrames.length);
......@@ -121,8 +122,8 @@ public class RawImageToArffDialog extends JInternalFrame {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
DesktopFrame[] desktopFrames = MainFrame.getInstance()
.getDesktop().getAllDesktopFrames();
ImageDesktopFrame[] desktopFrames = MainFrame.getInstance()
.getDesktop().getAllImageDesktopFrames();
int nbSessions = desktopFrames.length;
if (nbSessions > 0) {
String path = desktopFrames[comboImage.getSelectedIndex()]
......@@ -181,8 +182,8 @@ public class RawImageToArffDialog extends JInternalFrame {
* lance la création du fichier arff
*/
protected void buttonOk_actionPerformed() {// TODO
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDesktopFrames();
ImageDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllImageDesktopFrames();
int nbSessions = desktopFrames.length;
if (nbSessions == 0) {
JOptionPane
......
......@@ -27,16 +27,26 @@ KMeansSeedSelectionDialog.5=OK
KMeansSeedSelectionDialog.7=Image
KMeansSeedSelectionDialog.8=K-means seeds
ConstraintsSelectionDialog.0=Information
ConstraintsSelectionDialog.10=Must-Link
ConstraintsSelectionDialog.11=Cannot-Link
ConstraintsSelectionDialog.12=Label
ConstraintsSelectionDialog.100=Must-Link
ConstraintsSelectionDialog.101=Cannot-Link
ConstraintsSelectionDialog.102=Label
ConstraintsSelectionDialog.103=Clusters related
ConstraintsSelectionDialog.104=Number of cluster
ConstraintsSelectionDialog.105=Max. Cluster diameter
ConstraintsSelectionDialog.13=Add
ConstraintsSelectionDialog.15=pixel
ConstraintsSelectionDialog.16=min
ConstraintsSelectionDialog.17=max
ConstraintsSelectionDialog.21=Apply
ConstraintsSelectionDialog.22=Refresh
ConstraintsSelectionDialog.29=Zoom level at minimum ...
ConstraintsSelectionDialog.30=index(es)
ConstraintsSelectionDialog.30=indexes
ConstraintsSelectionDialog.31=Remove
ConstraintsSelectionDialog.32=index
ConstraintsSelectionDialog.33=Choose which class to assign,\nchoose "New class" if you want to assign to another class.
ConstraintsSelectionDialog.34=Assign class
ConstraintsSelectionDialog.35=New class
ConstraintsSelectionDialog.36=class
ConstraintsSelectionDialog.50=OK
ConstraintsSelectionDialog.51=Import
ConstraintsSelectionDialog.52=Export
......
......@@ -27,16 +27,26 @@ KMeansSeedSelectionDialog.5=OK
KMeansSeedSelectionDialog.7=Image
KMeansSeedSelectionDialog.8=K-moyens graines
ConstraintsSelectionDialog.0=Information
ConstraintsSelectionDialog.10=Must-Link
ConstraintsSelectionDialog.11=Cannot-Link
ConstraintsSelectionDialog.12=Label
ConstraintsSelectionDialog.100=Must-Link
ConstraintsSelectionDialog.101=Cannot-Link
ConstraintsSelectionDialog.102=Label
ConstraintsSelectionDialog.103=Relatives aux clusters
ConstraintsSelectionDialog.104=Nombre de cluster
ConstraintsSelectionDialog.105=Diametre de cluster max.
ConstraintsSelectionDialog.13=Ajouter
ConstraintsSelectionDialog.15=pixel
ConstraintsSelectionDialog.16=min
ConstraintsSelectionDialog.17=max
ConstraintsSelectionDialog.21=Appliquer
ConstraintsSelectionDialog.22=Rafraichir
ConstraintsSelectionDialog.29=Niveau de zoom est son minimum....
ConstraintsSelectionDialog.30=index(es)
ConstraintsSelectionDialog.30=indexes
ConstraintsSelectionDialog.31=Supr.
ConstraintsSelectionDialog.32=index
ConstraintsSelectionDialog.33=Choisissez une nouvelle classe,\nchoisissez "Nouvelle classe" si vous souhaitez affecter une nouvelle classe.
ConstraintsSelectionDialog.34=Affecation de classe
ConstraintsSelectionDialog.35=Nouvelle classe
ConstraintsSelectionDialog.36=classe
ConstraintsSelectionDialog.50=OK
ConstraintsSelectionDialog.51=Importer
ConstraintsSelectionDialog.52=Exporter
......
......@@ -117,6 +117,22 @@ CropDialog.70=_crop
CropDialog.71=Zoom level is at it's minimum...
CropDialog.8=Image
CropDialog.9=Informations
DataToArffDialog.0=Input Data \:
DataToArffDialog.12=Output file \:
DataToArffDialog.13=Browse
DataToArffDialog.15=Date (JJMMAA)\:
DataToArffDialog.16=Nb intervalles \:
DataToArffDialog.17=OK
DataToArffDialog.18=ARFF
DataToArffDialog.19=You must open a data before...
DataToArffDialog.20=Warning
DataToArffDialog.22=Select a data to save as.
DataToArffDialog.23=Warning
DataToArffDialog.24=There is no Data currently opened
DataToArffDialog.44=The file was created successfull.
DataToArffDialog.45=Successful
DataToArffDialog.6=DataToArffDialog \=> Nr. sesiune 1 \=
DataToArffDialog.7=DataToArffDialog \=> Nr. sesiune 2 \=
FilterDialog.1=majority
FilterDialog.2=Filter
FilterDialog.3=\ Type of filter \:
......
......@@ -117,6 +117,22 @@ CropDialog.70=_crop
CropDialog.71=Zoom level is at it's minimum...
CropDialog.8=Image
CropDialog.9=Informations
DataToArffDialog.0=Data en entre \:
DataToArffDialog.12=Fichier en sortie \:
DataToArffDialog.13=Parcourir...
DataToArffDialog.15=Date (JJMMAA)\:
DataToArffDialog.16=Nb intervalles \:
DataToArffDialog.17=OK
DataToArffDialog.18=ARFF
DataToArffDialog.19=Vous devez ouvrir un data auparavant...
DataToArffDialog.20=Avertissement
DataToArffDialog.22=Selectinnez le fichier sauvegarder.
DataToArffDialog.23=Avertissement
DataToArffDialog.24=Il n'y a aucun Data actuellement ouvert
DataToArffDialog.44=Le fichier a t cr avec succs.
DataToArffDialog.45=Avec succs
DataToArffDialog.6=DataToArffDialog \=> Nr. sesiune 1 \=
DataToArffDialog.7=DataToArffDialog \=> Nr. sesiune 2 \=
FilterDialog.1=majorit
FilterDialog.2=Filtre
FilterDialog.3=\ Type de filtre \:
......
......@@ -159,8 +159,10 @@ MainFrame.29=Apply mask...
MainFrame.3=nb sessions
MainFrame.30=Create a sub-image...
MainFrame.301=Constraints
MainFrame.302=Arff to Data
MainFrame.303=Data to Arff
MainFrame.31=TransformationBmpToRoi...
MainFrame.32=Image/ARFF
MainFrame.32=Image/Data/ARFF
MainFrame.33=Image to ARFF...
MainFrame.34=Load arff...
MainFrame.35=ARFF to image...
......
......@@ -159,8 +159,10 @@ MainFrame.29=Appliquer le masque...
MainFrame.3=nb sessions
MainFrame.30=Crer un sous-image...
MainFrame.301=Contraintes
MainFrame.302=Arff en Data
MainFrame.303=Data en Arff
MainFrame.31=TransformationBmpEnRoi...
MainFrame.32=Image/ARFF
MainFrame.32=Image/Data/ARFF
MainFrame.33=Image en ARFF...
MainFrame.34=Charger Arff...
MainFrame.35=ARFF en image...
......
package mustic.utils.dataExchange;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.attribute.AttributeNumerical;
import jcl.data.attribute.AttributeSequence;
import weka.core.Attribute;
import weka.core.DenseInstance;
import weka.core.Instances;
/**
* Class to import/export ARFF files from/to Data objects
*
* @author Baptiste LAFABREGUE
*
*/
public class DataArffExchange {
public static void dataToArff(String path, Data data) {
System.out.println("__________________________________________________________________________________________\n"); //$NON-NLS-1$
System.out.println("Write \""+data.getDataName()+"\" to file : " + path); //$NON-NLS-1$
System.out.println("__________________________________________________________________________________________"); //$NON-NLS-1$
ArrayList<Attribute> attributes = new ArrayList<Attribute>();
attributes.add(new Attribute("index"));
for(int i = 0 ; i < data.getOneDataObject().getAttributes().length ; i++ ) {
attributes.add(getArffAttribute(data.getOneDataObject().getAttributes()[i], i+1));
}
Instances arffData = new Instances(data.getDataName(), attributes, 0);
Iterator<DataObject> iter = data.iterator();
int k = 0;
while(iter.hasNext()) {
double[] values = new double[arffData.numAttributes()];
DataObject current = iter.next();
if (data.getSampler() != null) {
values[0] = data.getSampler().getSampleIndexes()[k];
} else {
values[0] = k;
}
for(int i = 0 ; i < current.getAttributes().length ; i++ ) {
values[i+1] = getArffInstance(current.getAttributes()[i], arffData, i+1);
}
arffData.add(new DenseInstance(1.0, values));
k++;
}
try {
FileOutputStream out = new FileOutputStream(path);
PrintWriter writer = new PrintWriter(out);
writer.println("% Data origin from files : \n% <<<");
for(String files : data.getDataFilesName()) {
writer.println("% \""+files+"\"");
}
writer.println("% >>>");
writer.println(arffData);
writer.close();
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static DataObject[] arffToData(String path) {
return null;
}
private static double getArffInstance(jcl.data.attribute.Attribute attr, Instances arffData, int attrIndex) {
if (attr instanceof AttributeSequence) {
Instances sequence = new Instances(arffData.attribute(attrIndex).relation(), 0);
double[] values = new double[((AttributeSequence) attr).sequence.length];
for(int i = 0 ; i < ((AttributeSequence) attr).sequence.length; i++) {
values[i] = ((AttributeSequence) attr).sequence[i];
sequence.add(new DenseInstance(1.0, values));
}
return arffData.attribute(attrIndex).addRelation(sequence);
// Multi-dimention sequences
} else if (attr instanceof AttributeMultiDimSequence) {
Instances sequence = new Instances(arffData.attribute(attrIndex).relation(), 0);
double[] values = new double[((AttributeMultiDimSequence) attr).sequence.length];
for(int i = 0 ; i < ((AttributeMultiDimSequence) attr).sequence.length; i++) {
Instances subSeq = new Instances(sequence.attribute(i).relation(), 0);
double[] subValues = new double[((AttributeMultiDimSequence) attr).sequence[i].length];
for(int j = 0 ; j < ((AttributeMultiDimSequence) attr).sequence[i].length ; j++) {
subValues[i] = ((AttributeMultiDimSequence) attr).sequence[i][j];
subSeq.add(new DenseInstance(1.0, subValues));
}
values[i] = sequence.attribute(i).addRelation(subSeq);
sequence.add(new DenseInstance(1.0, values));
}
return arffData.attribute(attrIndex).addRelation(sequence);
// numerical
} else if (attr instanceof AttributeNumerical) {
return ((AttributeNumerical) attr).getValue();
} else {
System.err.println("The attribute type "+ attr.getClass() +
" is not supported for export. See DataArffExchange class");
}
return -1;
}
private static Attribute getArffAttribute(jcl.data.attribute.Attribute attr, int attrIndex) {
Attribute result = null;
// simple sequences
if (attr instanceof AttributeSequence) {
ArrayList<Attribute> attributes = new ArrayList<Attribute>();
for(int i = 0 ; i < ((AttributeSequence) attr).sequence.length; i++) {
attributes.add(new Attribute("attr"+attrIndex+"."+i));
}
Instances sequence = new Instances("attr"+attrIndex, attributes, 0);
result = new Attribute("attr"+attrIndex, sequence, 0);
// Multi-dimention sequences
} else if (attr instanceof AttributeMultiDimSequence) {
ArrayList<Attribute> dimensions = new ArrayList<Attribute>();
for(int i = 0 ; i < ((AttributeMultiDimSequence) attr).sequence.length; i++) {
ArrayList<Attribute> attributes = new ArrayList<Attribute>();
for(int j = 0 ; j < ((AttributeMultiDimSequence) attr).sequence[i].length ; j++) {
attributes.add(new Attribute("attr"+attrIndex+"."+i+"."+j));
}
Instances dim = new Instances("attr"+attrIndex+"."+i, attributes, 0);
dimensions.add(new Attribute("attr"+attrIndex+"."+i, dim, i));
}
Instances sequence = new Instances("attr"+attrIndex, dimensions, 0);
result = new Attribute("attr"+attrIndex, sequence, 0);
// numerical
} else if (attr instanceof AttributeNumerical) {
result = new Attribute("attr"+attrIndex);
} else {
System.err.println("The attribute type "+ attr.getClass() +
" is not supported for export. See DataArffExchange class");
}
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment