Package weka.core

Examples of weka.core.FastVector.elementAt()


      } else {
      int nNodes = m_BayesNet.getNrOfNodes();
      boolean[] isNotAllowedAsParent = new boolean[nNodes];
      // prevent it being a parent of itself
      for (int iNode = 0; iNode < selected.size(); iNode++) {
        isNotAllowedAsParent[(Integer) selected.elementAt(iNode)] = true;
      }
      // prevent a descendant being a parent, since it introduces cycles
      for (int i = 0; i < nNodes; i++) {
        for (int iNode = 0; iNode < nNodes; iNode++) {
          for (int iParent = 0; iParent < m_BayesNet.getNrOfParents(iNode); iParent++) {
View Full Code Here


          }
        }
      }
      // prevent nodes that are already a parent
      for (int iNode = 0; iNode < selected.size(); iNode++) {
        int nNode = (Integer) selected.elementAt(iNode);
        for (int iParent = 0; iParent < m_BayesNet.getNrOfParents(nNode); iParent++) {
          isNotAllowedAsParent[m_BayesNet.getParent(nNode, iParent)] = true;
        }
      }
      ActionListener addParentAction = new ActionListener() {
View Full Code Here

      FastVector nChildren = m_BayesNet.getChildren(m_nCurrentNode);
      if (nChildren.size() == 0) {
        delChildMenu.setEnabled(false);
      }
      for (int iChild = 0; iChild < nChildren.size(); iChild++) {
        item = new JMenuItem(m_BayesNet.getNodeName((Integer) nChildren.elementAt(iChild)));
        item.addActionListener(delChildAction);
        delChildMenu.add(item);
      }

      popupMenu.addSeparator();
View Full Code Here

        drawArrow(g, nPosX2b, nPosY2b, nPosX1, nPosY1);
      }
      if (mode == HIGHLIGHTED) {
      FastVector children = m_BayesNet.getChildren(iNode);
      for (int iChild = 0; iChild < children.size(); iChild++) {
        int nChild = (Integer) children.elementAt(iChild);
        int nPosX1 = nPosX + m_nPaddedNodeWidth / 2;
        int nPosY1 = nPosY;
        int nPosX2 = m_BayesNet.getPositionX(nChild);
        int nPosY2 = m_BayesNet.getPositionY(nChild);
        int nPosX2b = nPosX2 + m_nPaddedNodeWidth / 2;
View Full Code Here

                                   + getMinRuleSize();

    RuleList newRule = new RuleList();
    for (int i=0; i < ruleSize; i++) {
      int testIndex = (int) (random.nextDouble() * (double) TestList.size());
      Test test = (Test) TestList.elementAt(testIndex);
         
      newRule.addTest(test);
      TestList.removeElementAt(testIndex);
    }
    double newClassValue = 0.0;
View Full Code Here

        // be a numeric variable.
        if (tempHash.size() == 0) {
          for (int j = 0; j < m_cumulativeInstances.size(); j++) {
            FastVector tempUpdate =
              ((FastVector)m_cumulativeInstances.elementAt(j));
            Object tempO = tempUpdate.elementAt(i);
            if (tempO instanceof String) {
              // must have been a missing value
            } else {
              if (!tempHash.containsKey(tempO)) {
                tempHash.put(new Double(((Double)tempO).doubleValue()),
View Full Code Here

    Instances temp_trainHeader = null;
    int[] temp_ignoreAtts = null;
   
    if (o != null) {
      for (int i = 0; i < o.size(); i++) {
  Object temp = o.elementAt(i);
  if (temp instanceof Clusterer) {
    temp_clusterer = (Clusterer)temp;
  } else if (temp instanceof Instances) { // training header
    temp_trainHeader = (Instances)temp;
  } else if (temp instanceof int[]) { // ignored attributes
View Full Code Here

    result = useClassifier();
    assertTrue(result.size() != 0);
    double minp = 0;
    double maxp = 0;
    for (int i = 0; i < result.size(); i++) {
      NominalPrediction p = (NominalPrediction)result.elementAt(i);
      double prob = p.distribution()[cind];
      if ((i == 0) || (prob < minp)) minp = prob;
      if ((i == 0) || (prob > maxp)) maxp = prob;
    }
    assertTrue("Upper limit shouldn't increase", maxp <= 1.0);
View Full Code Here

    //    VisualizePanel temp_vp = null;
    Instances tempTransformed = null;

    if (o != null) {
      for (int i = 0; i < o.size(); i++) {
  Object temp = o.elementAt(i);
  //  if (temp instanceof VisualizePanel) {
  if (temp instanceof Instances) {
    //    temp_vp = (VisualizePanel)temp;
    tempTransformed = (Instances) temp;
  }
View Full Code Here

      m_NewBatch = false;
    }
    if (isFirstBatchDone()) {
      FastVector fv = new FastVector();
      int firstCopy = convertInstancewoDocNorm(instance, fv);
      Instance inst = (Instance)fv.elementAt(0);
      if (m_filterType != FILTER_NONE) {
  normalizeInstance(inst, firstCopy);
      }
      push(inst);
      return true;
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.