Package weka.core

Examples of weka.core.DenseInstance


      // generate and add instance
      if (inst instanceof SparseInstance)
  newInst = new SparseInstance(instances.instance(i).weight(), values);
      else
  newInst = new DenseInstance(instances.instance(i).weight(), values);
      result.add(newInst);
    }

    return result;
  }
View Full Code Here


          else {
            values[i] = toPredict.value(i-1);
          }
        }

        m_PlotInstances.add(new DenseInstance(1.0, values));
       
        if (toPredict.classAttribute().isNominal()) {
          if (toPredict.isMissing(toPredict.classIndex()) || Utils.isMissingValue(pred)) {
            m_PlotShapes.addElement(new Integer(Plot2D.MISSING_SHAPE));
          }
View Full Code Here

    values[m_PlotInstances.numAttributes() + n*3 + 1] = Utils.missingValue();
    values[m_PlotInstances.numAttributes() + n*3 + 2] = Utils.missingValue();
  }
      }
      // create new Instance
      newInst = new DenseInstance(inst.weight(), values);
      data.add(newInst);
    }
   
    m_PlotInstances = data;
  }
View Full Code Here

      }
      Instance newInst;
      if (m_CreateSparseData) {
  newInst = new SparseInstance(1.0, vals);
      } else {
  newInst = new DenseInstance(1.0, vals);
      }
      instances.addElement(newInst);
      rowCount++;
    }
    //disconnectFromDatabase();  (perhaps other queries might be made)
View Full Code Here

   
    newInst[0] = (double) data.attribute(0).addStringValue(txtStr.toString());
    if (m_OutputFilename)
      newInst[1] = (double) data.attribute(1).addStringValue(subdirPath + File.separator + files[j]);
    newInst[data.classIndex()] = (double) k;
    data.add(new DenseInstance(1.0, newInst));
          is.close();
  }
  catch (Exception e) {
    System.err.println("failed to convert file: " + directoryPath + File.separator + subdirPath + File.separator + files[j]);
  }
View Full Code Here

  System.err.println("Error parsing value #" + (index+1) + ": " + e.toString());
  return null;
      }
    }

    result = new DenseInstance(weight, vals);
    result.setDataset(data);
     
    return result;
  }
View Full Code Here

  default:
    vals[i - 1] = Utils.missingValue();
  }
      }
      Instance newInst;
      newInst = new DenseInstance(1.0, vals);
      instances.add(newInst);
    }  
   
    // Create the header and add the instances to the dataset
    //System.err.println("Creating header...");
View Full Code Here

          break;
  default:
    vals[i - 1] = Utils.missingValue();
  }
      }
       Instance inst = new DenseInstance(1.0, vals);
       //get rid of m_idColumn
       if(m_DataBaseConnection.getUpperCase())
              m_idColumn = m_idColumn.toUpperCase();
       if(m_structure.attribute(0).name().equals(m_idColumn)){
            inst.deleteAttributeAt(0);
            m_oldStructure.add(inst);
            inst = m_oldStructure.instance(0);
            m_oldStructure.delete(0);
       }
       else{
View Full Code Here

    String    field;

    result = new StringBuffer();
   
    if (inst instanceof SparseInstance) {
      outInst = new DenseInstance(inst.weight(), inst.toDoubleArray());
      outInst.setDataset(inst.dataset());
    }
    else {
      outInst = inst;
    }
View Full Code Here

          weight = 1.0;
        }
      }
       
      // Add instance to dataset
      Instance inst = new DenseInstance(weight, instance);
      inst.setDataset(m_Data);
     
      return inst;
    }
View Full Code Here

TOP

Related Classes of weka.core.DenseInstance

Copyright © 2018 www.massapicom. 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.