Package weka.core

Examples of weka.core.DenseInstance


    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


      }
       Instance inst;
       if (m_CreateSparseData)
   inst = new SparseInstance(1.0, vals);
       else
   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);
View Full Code Here

        vals[0] = current.value(10); // sample size
        vals[1] = (current.value(0) * tpCost
            + current.value(1) * fnCost
            + current.value(2) * fpCost
            + current.value(3) * tnCost) * scaleFactor;
        Instance newInst = new DenseInstance(1.0, vals);
        costBenefitI.add(newInst);
      }
     
      costBenefitI.compactify();
     
View Full Code Here

      atts[i + 7] = random.nextInt(2);

    atts[atts.length - 1] = selected;

    // create instance
    result  = new DenseInstance(1.0, atts);
    result.setDataset(m_DatasetFormat);

    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

      } else {
        m_vals[i] = Utils.missingValue();
      }
    }
   
    Instance newInst = new DenseInstance(incoming.weight(), m_vals);
    newInst.setDataset(m_modelHeader);

    return newInst;
  }
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

          newInst[1] = 0;
          structure.attribute(1).setStringValue(txt.getAbsolutePath());
        }
      }
      newInst[structure.classIndex()] = (double) m_lastClassDir;
      Instance inst = new DenseInstance(1.0, newInst);
      inst.setDataset(structure);
      is.close();
     
      m_lastClassDir++;
      if (m_lastClassDir == structure.classAttribute().numValues()) {
        m_lastClassDir = 0;
View Full Code Here

      resetQueue();
      m_NewBatch = false;
    }
    Instance inst = null;
    if (instance instanceof SparseInstance) {
      inst = new DenseInstance(instance.weight(), instance.toDoubleArray());
      inst.setDataset(instance.dataset());
    } else {
      inst = instance;
    }
    push(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.