Package weka.core

Examples of weka.core.SparseInstance


                sparseValues[count] = histClassCounts[i][j];
                sparseIndices[count++] = j;
              }
            }
           
            SparseInstance tempS =
              new SparseInstance(1.0, sparseValues, sparseIndices,
                  histClassCounts[i].length);
            histClassCountsSparse[i] = tempS;
           
          }
         
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 Instance(instance.weight(), vals);

    inst.setDataset(getOutputFormat());
    copyValues(inst, false, instance.dataset(), getOutputFormat());
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 Instance(instance.weight(), newVals);
   
    return result;
  }
View Full Code Here

    m_attributeExpression.evaluateExpression(vals);

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

    inst.setDataset(getOutputFormat());
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 Instance(inst.weight(), values);
     
      // copy possible string, relational values
      newInst.setDataset(getOutputFormat());
View Full Code Here

        newValues[m_outputNumAttributes - 1] = currentInstance.classValue();
      }
      //create new instance with recorded values and add to output dataset
      Instance newInstance;
      if (currentInstance instanceof SparseInstance) {
        newInstance = new SparseInstance(currentInstance.weight(), newValues);
      } else {
        newInstance = new Instance(currentInstance.weight(), newValues);
      }
      output.add(newInstance);
    }
View Full Code Here

      newValues[i] = instanceVector.get(0, i);
    }
   
    // return newly transformed instance
    if (instance instanceof SparseInstance) {
      return new SparseInstance(instance.weight(), newValues);
    } else {
      return new Instance(instance.weight(), newValues);
    }
  }
View Full Code Here

       }
      newVals[i] = tempval;
    }
   
    if (inst instanceof SparseInstance) {
      return new SparseInstance(inst.weight(), newVals);
    } else {
      return new Instance(inst.weight(), newVals);
    }     
  }
View Full Code Here

      }
    }
   
    if (!m_transBackToOriginal) {
      if (instance instanceof SparseInstance) {
      return new SparseInstance(instance.weight(), newVals);
      } else {
        return new Instance(instance.weight(), newVals);
      }     
    } else {
      if (instance instanceof SparseInstance) {
        return convertInstanceToOriginal(new SparseInstance(instance.weight(),
                                                            newVals));
      } else {
        return convertInstanceToOriginal(new Instance(instance.weight(),
                                                      newVals));
      }
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.