Refine search
/** * Checks for attributes of the given type in the dataset * * @param attType the attribute type to look for * @return true if attributes of the given type are present */ public boolean checkForAttributeType(int attType) { int i = 0; while (i < m_Attributes.size()) { if (attribute(i++).type() == attType) { return true; } } return false; }
/** * Initializes the m_Attributes of the class. */ private void init() { try { m_NumInstances = m_TrainSet.numInstances(); m_NumClasses = m_TrainSet.numClasses(); m_NumAttributes = m_TrainSet.numAttributes(); m_ClassType = m_TrainSet.classAttribute().type(); } catch (Exception e) { e.printStackTrace(); } }
for (int j = 0; j < inputFormat.numAttributes(); j++) { if (inputFormat.attribute(j).type() == Attribute.STRING) { fields.append((j + 1) + ","); m_selectedRange.setUpper(inputFormat.numAttributes() - 1); for (int j = 0; j < inputFormat.numAttributes(); j++) { if (m_selectedRange.getInvert()) { if (!m_selectedRange.isInRange(j) || inputFormat.attribute(j).type() != Attribute.STRING) { fields.append((j + 1) + ","); && inputFormat.attribute(j).type() == Attribute.STRING) { fields.append((j + 1) + ",");
/** * Creates the HyperPipe as the n-dimensional parallel-piped * with minimum volume containing all the points in * pointSet. * * @param instances all instances belonging to the same class * @throws Exception if missing values are found */ public HyperPipe(Instances instances) throws Exception { m_NumericBounds = new double [instances.numAttributes()][]; m_NominalBounds = new boolean [instances.numAttributes()][]; for (int i = 0; i < instances.numAttributes(); i++) { switch (instances.attribute(i).type()) { case Attribute.NUMERIC: m_NumericBounds[i] = new double [2]; m_NumericBounds[i][0] = Double.POSITIVE_INFINITY; m_NumericBounds[i][1] = Double.NEGATIVE_INFINITY; break; case Attribute.NOMINAL: m_NominalBounds[i] = new boolean [instances.attribute(i).numValues()]; break; default: throw new UnsupportedAttributeTypeException("Cannot process string attributes!"); } } for (int i = 0; i < instances.numInstances(); i++) { addInstance(instances.instance(i)); } }
/** * Checks for attributes of the given type in the dataset * * @param attType the attribute type to look for * @return true if attributes of the given type are present */ public boolean checkForAttributeType(int attType) { int i = 0; while (i < m_Attributes.size()) { if (attribute(i++).type() == attType) { return true; } } return false; }
/** * Initializes the m_Attributes of the class. */ private void init_m_Attributes() { try { m_NumInstances = m_Train.numInstances(); m_NumClasses = m_Train.numClasses(); m_NumAttributes = m_Train.numAttributes(); m_ClassType = m_Train.classAttribute().type(); m_InitFlag = ON; } catch(Exception e) { e.printStackTrace(); } }
/** * initializes variables etc. * * @param data the data to use */ @Override protected void initVars(Instances data) { super.initVars(data); m_kernelEvals = 0; // take the first string attribute m_strAttr = -1; for (int i = 0; i < data.numAttributes(); i++) { if (i == data.classIndex()) { continue; } if (data.attribute(i).type() == Attribute.STRING) { m_strAttr = i; break; } } m_numInsts = m_data.numInstances(); m_storage = new double[m_cacheSize]; m_keys = new long[m_cacheSize]; m_powersOflambda = calculatePowersOfLambda(); }
/** * Deletes all attributes of the given type in the dataset. A deep copy of the * attribute information is performed before an attribute is deleted. * * @param attType the attribute type to delete * @throws IllegalArgumentException if attribute couldn't be successfully * deleted (probably because it is the class attribute). */ public void deleteAttributeType(int attType) { int i = 0; while (i < m_Attributes.size()) { if (attribute(i).type() == attType) { deleteAttributeAt(i); } else { i++; } } }
/** * Initializes the m_Attributes of the class. */ private void init() { try { m_NumInstances = m_TrainSet.numInstances(); m_NumClasses = m_TrainSet.numClasses(); m_NumAttributes = m_TrainSet.numAttributes(); m_ClassType = m_TrainSet.classAttribute().type(); } catch (Exception e) { e.printStackTrace(); } }
int asize = data1.numAttributes(); boolean strings_pos[] = new boolean[asize]; for(int i=0; i<asize; i++) Attribute att = data1.attribute(i); strings_pos[i] = ((att.type() == Attribute.STRING) || (att.type() == Attribute.NOMINAL));
/** * Deletes all attributes of the given type in the dataset. A deep copy of the * attribute information is performed before an attribute is deleted. * * @param attType the attribute type to delete * @throws IllegalArgumentException if attribute couldn't be successfully * deleted (probably because it is the class attribute). */ public void deleteAttributeType(int attType) { int i = 0; while (i < m_Attributes.size()) { if (attribute(i).type() == attType) { deleteAttributeAt(i); } else { i++; } } }
/** * Initializes the m_Attributes of the class. */ private void init() { try { m_NumInstances = m_TrainSet.numInstances(); m_NumClasses = m_TrainSet.numClasses(); m_NumAttributes = m_TrainSet.numAttributes(); m_ClassType = m_TrainSet.classAttribute().type(); } catch (Exception e) { e.printStackTrace(); } }
/** * initializes variables etc. * * @param data the data to use */ @Override protected void initVars(Instances data) { super.initVars(data); m_kernelEvals = 0; // take the first string attribute m_strAttr = -1; for (int i = 0; i < data.numAttributes(); i++) { if (i == data.classIndex()) { continue; } if (data.attribute(i).type() == Attribute.STRING) { m_strAttr = i; break; } } m_numInsts = m_data.numInstances(); m_storage = new double[m_cacheSize]; m_keys = new long[m_cacheSize]; m_powersOflambda = calculatePowersOfLambda(); }
/** * sets up the structure */ protected void locate() { int i; m_Attributes = new BitSet(m_AllowedIndices.length); m_Locators = new ArrayList<AttributeLocator>(); for (i = 0; i < m_AllowedIndices.length; i++) { if (m_Data.attribute(m_AllowedIndices[i]).type() == Attribute.RELATIONAL) m_Locators.add(new AttributeLocator(m_Data.attribute(m_AllowedIndices[i]).relation(), getType())); else m_Locators.add(null); m_Attributes.set(i, m_Data.attribute(m_AllowedIndices[i]).type() == getType()); } }
/** * Initializes the m_Attributes of the class. */ private void init() { try { m_NumInstances = m_TrainSet.numInstances(); m_NumClasses = m_TrainSet.numClasses(); m_NumAttributes = m_TrainSet.numAttributes(); m_ClassType = m_TrainSet.classAttribute().type(); } catch (Exception e) { e.printStackTrace(); } }
/** * Initialize with data from the step */ protected void initialize() { m_stringInstances = ((DataGrid) getStepToEdit()).getData(); m_listModel = new DefaultListModel<>(); m_list.setModel(m_listModel); if (m_stringInstances != null && m_stringInstances.length() > 0) { try { Instances insts = new Instances(new StringReader(m_stringInstances)); for (int i = 0; i < insts.numAttributes(); i++) { Attribute a = insts.attribute(i); String nomOrDate = ""; if (a.isNominal()) { for (int j = 0; j < a.numValues(); j++) { nomOrDate += a.value(j) + ","; } nomOrDate = nomOrDate.substring(0, nomOrDate.length() - 1); } else if (a.isDate()) { nomOrDate = a.getDateFormat(); } AttDef def = new AttDef(a.name(), a.type(), nomOrDate); m_listModel.addElement(def); } m_viewerPanel.setInstances(insts); } catch (Exception ex) { showErrorDialog(ex); } } }
/** * sets up the structure */ protected void locate() { int i; m_Attributes = new BitSet(m_AllowedIndices.length); m_Locators = new ArrayList<AttributeLocator>(); for (i = 0; i < m_AllowedIndices.length; i++) { if (m_Data.attribute(m_AllowedIndices[i]).type() == Attribute.RELATIONAL) m_Locators.add(new AttributeLocator(m_Data.attribute(m_AllowedIndices[i]).relation(), getType())); else m_Locators.add(null); m_Attributes.set(i, m_Data.attribute(m_AllowedIndices[i]).type() == getType()); } }
/** * Initializes the m_Attributes of the class. */ private void init_m_Attributes() { try { m_NumInstances = m_Train.numInstances(); m_NumClasses = m_Train.numClasses(); m_NumAttributes = m_Train.numAttributes(); m_ClassType = m_Train.classAttribute().type(); m_InitFlag = ON; } catch(Exception e) { e.printStackTrace(); } }
/** * Initialize with data from the step */ protected void initialize() { m_stringInstances = ((DataGrid) getStepToEdit()).getData(); m_listModel = new DefaultListModel<>(); m_list.setModel(m_listModel); if (m_stringInstances != null && m_stringInstances.length() > 0) { try { Instances insts = new Instances(new StringReader(m_stringInstances)); for (int i = 0; i < insts.numAttributes(); i++) { Attribute a = insts.attribute(i); String nomOrDate = ""; if (a.isNominal()) { for (int j = 0; j < a.numValues(); j++) { nomOrDate += a.value(j) + ","; } nomOrDate = nomOrDate.substring(0, nomOrDate.length() - 1); } else if (a.isDate()) { nomOrDate = a.getDateFormat(); } AttDef def = new AttDef(a.name(), a.type(), nomOrDate); m_listModel.addElement(def); } m_viewerPanel.setInstances(insts); } catch (Exception ex) { showErrorDialog(ex); } } }
/** * returns the TYPE of the attribute at the given position * * @param rowIndex the index of the row * @param columnIndex the index of the column * @return the attribute type */ public int getType(int rowIndex, int columnIndex) { int result; result = Attribute.STRING; if ((rowIndex < 0) && columnIndex > 0 && columnIndex < getColumnCount()) { result = m_Data.attribute(columnIndex - 1).type(); } else if ((rowIndex >= 0) && (rowIndex < getRowCount()) && (columnIndex > 0) && (columnIndex < getColumnCount())) { result = m_Data.instance(rowIndex).attribute(columnIndex - 1).type(); } return result; }