Package weka.core

Examples of weka.core.SparseInstance


    data[data.length - 1] = result.classAttribute().indexOfValue("-1");
  else
    throw new IllegalStateException("Class is not binary!");
      }
     
      result.add(new SparseInstance(1, data));
    }

    try {
      // close the stream
      m_sourceReader.close();
View Full Code Here


    vals[i - 1] = Utils.missingValue();
  }
      }
       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();
View Full Code Here

        }
        if (m_encodeMissingAsZero && Utils.isMissingValue(values[i])) {
          values[i] = 0;
        }
      }
      newInstance = new SparseInstance(instance.weight(), values);
      newInstance.setDataset(getOutputFormat());
      push(newInstance);
    } else {
      newInstance = new SparseInstance(instance);
      newInstance.setDataset(instance.dataset());
      push(newInstance);
    }
   
    /*Instance inst = new SparseInstance(instance);
View Full Code Here

      Double value = (Double)contained.get(index);
      values[i] = value.doubleValue();
      indices[i] = index.intValue();
    }

    Instance inst = new SparseInstance(instance.weight(), values, indices,
  outputFormatPeek().numAttributes());
    inst.setDataset(outputFormatPeek());

    v.addElement(inst);

    return firstCopy;   
  }
View Full Code Here

  break;
    }

    // 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

      instanceVals[instance.numAttributes()] = Utils.missingValue();
    }

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

    processed.setDataset(instance.dataset());
View Full Code Here

  values[n] = result.attribute(n).indexOfValue(value);
      }
     
      // 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());
View Full Code Here

      int current = m_SelectedAttributes[i];
      vals[i] = instance.value(current);
    }
    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());
View Full Code Here

    m_attributeExpression.evaluateExpression(vals);

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

    inst.setDataset(getOutputFormat());
View Full Code Here

          vals[i - 1] = Utils.missingValue();
        }
      }
      Instance newInst;
      if (adapter.getSparseData()) {
        newInst = new SparseInstance(1.0, vals);
      } else {
        newInst = new DenseInstance(1.0, vals);
      }
      instances.addElement(newInst);
      rowCount++;
View Full Code Here

TOP

Related Classes of weka.core.SparseInstance

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.