Package weka.core

Examples of weka.core.Attribute.type()


      Attribute attribute = (Attribute) enu.nextElement();

      // If the attribute is numeric, determine the estimator
      // numeric precision from differences between adjacent values
      double numPrecision = DEFAULT_NUM_PRECISION;
      if (attribute.type() == Attribute.NUMERIC) {
  m_Instances.sort(attribute);
  if ((m_Instances.numInstances() > 0)
      && !m_Instances.instance(0).isMissing(attribute)) {
    double lastVal = m_Instances.instance(0).value(attribute);
    double currentVal, deltaSum = 0;
View Full Code Here


  }
      }


      for (int j = 0; j < m_Instances.numClasses(); j++) {
  switch (attribute.type()) {
  case Attribute.NUMERIC:
    if (m_UseKernelEstimator) {
      m_Distributions[attIndex][j] =
        new KernelEstimator(numPrecision);
    } else {
View Full Code Here

    boolean bHasMissingValues = false;

    Enumeration enu = instances.enumerateAttributes();   
    while (enu.hasMoreElements()) {
      Attribute attribute = (Attribute) enu.nextElement();
      if (attribute.type() != Attribute.NOMINAL) {
  m_nNonDiscreteAttribute = attribute.index();
  bHasNonNominal = true;
  //throw new UnsupportedAttributeTypeException("BayesNet handles nominal variables only. Non-nominal variable in dataset detected.");
      }
      Enumeration enum2 = instances.enumerateInstances();
View Full Code Here

      for (int j = 0; j < dataSet.numAttributes(); j++) {
        if (dataSet.attribute(j).name().equals(schemaAttName)) {
          Attribute miningSchemaAtt = fieldsI.attribute(i);
          Attribute incomingAtt = dataSet.attribute(j);
          // check type match
          if (miningSchemaAtt.type() != incomingAtt.type()) {
            if (miningSchemaAtt.isString() && incomingAtt.isNominal()) {
              // don't worry about String attributes in the mining schema
              // (as long as the corresponding incoming is a String or nominal),
              // since values for the String attributes are more than likely revealed
              // by FieldRef elements in the actual model itself
View Full Code Here

   */
  protected void setHeader(int index) {
   
    Attribute att = m_Instances.attribute(index);
    m_AttributeNameLab.setText(att.name());
    switch (att.type()) {
    case Attribute.NOMINAL:
      m_AttributeTypeLab.setText(Messages.getInstance().getString("AttributeSummaryPanel_SetHeader_AttributeNOMINAL_Text"));
      break;
    case Attribute.NUMERIC:
      m_AttributeTypeLab.setText(Messages.getInstance().getString("AttributeSummaryPanel_SetHeader_AttributeNUMERIC_Text"));
View Full Code Here

   */
  protected void setHeader(int index) {
   
    Attribute att = m_Instances.attribute(index);
    m_AttributeNameLab.setText(att.name());
    switch (att.type()) {
    case Attribute.NOMINAL:
      m_AttributeTypeLab.setText("Nominal");
      break;
    case Attribute.NUMERIC:
      m_AttributeTypeLab.setText("Numeric");
View Full Code Here

      Attribute attribute = (Attribute) enu.nextElement();

      // If the attribute is numeric, determine the estimator
      // numeric precision from differences between adjacent values
      double numPrecision = DEFAULT_NUM_PRECISION;
      if( attribute.type() == Attribute.NUMERIC ) {
        m_Instances.sort( attribute );
        if( (m_Instances.numInstances() > 0) && !m_Instances.instance( 0 ).isMissing( attribute ) ) {
          double lastVal = m_Instances.instance( 0 ).value( attribute );
          double currentVal, deltaSum = 0;
          int distinct = 0;
View Full Code Here

        }
      }


      for( int j = 0; j < m_Instances.numClasses(); j++ ) {
        switch( attribute.type() ) {
          case Attribute.NUMERIC:
            if( m_UseKernelEstimator ) {
              m_Distributions[attIndex][j] =
                  new KernelEstimator( numPrecision );
            } else {
View Full Code Here

    boolean bHasMissingValues = false;

    Enumeration enu = instances.enumerateAttributes();   
    while (enu.hasMoreElements()) {
      Attribute attribute = (Attribute) enu.nextElement();
      if (attribute.type() != Attribute.NOMINAL) {
  m_nNonDiscreteAttribute = attribute.index();
  bHasNonNominal = true;
  //throw new UnsupportedAttributeTypeException("BayesNet handles nominal variables only. Non-nominal variable in dataset detected.");
      }
      Enumeration enum2 = instances.enumerateInstances();
View Full Code Here

   */
  protected void setHeader(int index) {
   
    Attribute att = m_Instances.attribute(index);
    m_AttributeNameLab.setText(att.name());
    switch (att.type()) {
    case Attribute.NOMINAL:
      m_AttributeTypeLab.setText("Nominal");
      break;
    case Attribute.NUMERIC:
      m_AttributeTypeLab.setText("Numeric");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.