Package weka.core

Examples of weka.core.Instance.numValues()


    enu = instances.enumerateInstances();
    while(enu.hasMoreElements())
    {
      Instance temp = (Instance)enu.nextElement();
      logger.info("Parsing " + temp);
      if(temp.numValues()!=3) throw new Exception("Group-Strategy assignment line does not have 3 elements. This is illegal.");
      Double[] strGrpInstance = new Double[3];
      for(int i=0;i<temp.numValues();i++)
      {
        //number of values == 3
        strGrpInstance[i] = temp.value(i);
View Full Code Here


    {
      Instance temp = (Instance)enu.nextElement();
      logger.info("Parsing " + temp);
      if(temp.numValues()!=3) throw new Exception("Group-Strategy assignment line does not have 3 elements. This is illegal.");
      Double[] strGrpInstance = new Double[3];
      for(int i=0;i<temp.numValues();i++)
      {
        //number of values == 3
        strGrpInstance[i] = temp.value(i);
        if(strGrpInstance[i]==null) throw new Exception("A parameter in group-strategy line is null.");
      }
View Full Code Here

        Instance temp = (Instance)enu.nextElement();
        logger.info("Parsing " + temp);
        String[] feedbackInstance = new String[3];
        //go through each feedback line
       
        if(temp.numValues()!=3) throw new Exception("Feedback line does not have 3 elements. This is illegal.");
       
        for(int i=0;i<temp.numValues();i++)
        {
          //number of values == 3
          feedbackInstance[i] = temp.stringValue(i);         
View Full Code Here

        String[] feedbackInstance = new String[3];
        //go through each feedback line
       
        if(temp.numValues()!=3) throw new Exception("Feedback line does not have 3 elements. This is illegal.");
       
        for(int i=0;i<temp.numValues();i++)
        {
          //number of values == 3
          feedbackInstance[i] = temp.stringValue(i);         
        }
        Agent assessor = new Agent(new Integer(feedbackInstance[0]));
View Full Code Here

      }
     
      // Update weight vector to reflect change a1 and a2, if linear SVM
      if (m_KernelIsLinear) {
  Instance inst1 = m_data.instance(i1);
  for (int p1 = 0; p1 < inst1.numValues(); p1++) {
    if (inst1.index(p1) != m_data.classIndex()) {
      m_weights[inst1.index(p1)] +=
        y1 * (a1 - alph1) * inst1.valueSparse(p1);
    }
  }
View Full Code Here

      m_weights[inst1.index(p1)] +=
        y1 * (a1 - alph1) * inst1.valueSparse(p1);
    }
  }
  Instance inst2 = m_data.instance(i2);
  for (int p2 = 0; p2 < inst2.numValues(); p2++) {
    if (inst2.index(p2) != m_data.classIndex()) {
      m_weights[inst2.index(p2)] +=
        y2 * (a2 - alph2) * inst2.valueSparse(p2);
    }
  }
View Full Code Here

    }

    // Get counts
    for (int k = 0; k < numInstances; k++) {
      Instance inst = data.instance(k);
      for (int i = 0; i < inst.numValues(); i++) {
        if (inst.index(i) != classIndex) {
          if (inst.isMissingSparse(i) || inst.classIsMissing()) {
            if (!inst.isMissingSparse(i)) {
              counts[inst.index(i)][(int)inst.valueSparse(i)][numClasses] +=
                inst.weight();
View Full Code Here

    }

    // Get counts
    for (int k = 0; k < numInstances; k++) {
      Instance inst = data.instance(k);
      for (int i = 0; i < inst.numValues(); i++) {
        if (inst.index(i) != classIndex) {
          if (inst.isMissingSparse(i) || inst.classIsMissing()) {
            if (!inst.isMissingSparse(i)) {
              counts[inst.index(i)][(int)inst.valueSparse(i)][numClasses] +=
                inst.weight();
View Full Code Here

    }
   
    for (int i = 0; i < data.numInstances(); i++) {
      Instance current = data.instance(i);
      if (current instanceof SparseInstance) {
        for (int j = 0; j < current.numValues(); j++) {
          int attIndex = current.index(j);
          singletons.get(attIndex).increaseFrequency();
        }
      } else {
        for (int j = 0; j < data.numAttributes(); j++) {
View Full Code Here

  
    for (int i = 0; i < data.numInstances(); i++) {
      Instance current = data.instance(i);
      ArrayList<BinaryItem> transaction = new ArrayList<BinaryItem>();
      if (current instanceof SparseInstance) {
        for (int j = 0; j < current.numValues(); j++) {
          int attIndex = current.index(j);
          if (singletons.get(attIndex).getFrequency() >= minSupport) {
            transaction.add(singletons.get(attIndex));
          }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.