Package weka.core

Examples of weka.core.DenseInstance


   
    values = new double[m_Indices.length];
    for (i = 0; i < m_Indices.length; i++)
      values[i] = instance.value(m_Indices[i]);

    result = new DenseInstance(instance.weight(), values);
    result.setDataset(getOutputFormat());
   
    copyValues(result, false, instance.dataset(), getOutputFormat());
    result.setDataset(getOutputFormat());
   
View Full Code Here


   
    // generate new Instance
    values = instance.toDoubleArray();
    if (!instance.isMissing(m_AttIndex.getIndex()))
      values[m_AttIndex.getIndex()] = m_SortedIndices[(int) values[m_AttIndex.getIndex()]];
    newInstance = new DenseInstance(instance.weight(), values);

    // copy string values etc. from input to output
    copyValues(instance, false, instance.dataset(), getOutputFormat());
   
    push(newInstance);
View Full Code Here

    // create instance
    if (instance instanceof SparseInstance)
      result = new SparseInstance(instance.weight(), newVals);
    else
      result = new DenseInstance(instance.weight(), newVals);
   
    return result;
  }
View Full Code Here

    // create new instance
    if (original instanceof SparseInstance) {
      processed = new SparseInstance(original.weight(), instanceVals);
    } else {
      processed = new DenseInstance(original.weight(), instanceVals);
    }

    processed.setDataset(instance.dataset());
    copyValues(processed, false, instance.dataset(), getOutputFormat());
    processed.setDataset(getOutputFormat());
View Full Code Here

     
      // generate new instance
      if (inst instanceof SparseInstance)
  newInst = new SparseInstance(inst.weight(), values);
      else
  newInst = new DenseInstance(inst.weight(), values);
     
      // copy possible string, relational values
      newInst.setDataset(getOutputFormat());
      copyValues(newInst, false, inst.dataset(), getOutputFormat());
     
View Full Code Here

    }
    Instance inst = null;
    if (instance instanceof SparseInstance)
      inst = new SparseInstance(instance.weight(), vals);
    else
      inst = new DenseInstance(instance.weight(), vals);

    inst.setDataset(getOutputFormat());
    copyValues(inst, false, instance.dataset(), getOutputFormat());
    inst.setDataset(getOutputFormat());
   
View Full Code Here

    Instance inst = null;
    if (instance instanceof SparseInstance) {
      inst = new SparseInstance(instance.weight(), vals);
    } else {
      inst = new DenseInstance(instance.weight(), vals);
    }

    inst.setDataset(getOutputFormat());
    copyValues(inst, false, instance.dataset(), getOutputFormat());
    inst.setDataset(getOutputFormat());
View Full Code Here

      }
      Instance newInst;
      if (adapter.getSparseData()) {
        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

      }     
    } catch (Exception ex) {
      ex.printStackTrace();
      return;
    } finally {
      newInst = new DenseInstance(currentI.weight(), instanceVals);
      newInst.setDataset(m_format);
      m_instanceEvent.setInstance(newInst);
      m_instanceEvent.setStatus(status);
      // notify listeners
      notifyInstanceAvailable(m_instanceEvent);
View Full Code Here

    desiredMag = rand.nextGaussian() * m_centroidStdDevs[centroid];
    scale      = desiredMag / magnitude;
    for (i = 0; i < getNumAttributes(); i++) {
      atts[i] *= scale;
      atts[i] += m_centroids[centroid][i];
      result   = new DenseInstance(1.0, atts);
    }

    // dataset reference
    result.setDataset(m_DatasetFormat);
   
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.