當前位置: 首頁>>代碼示例>>Java>>正文


Java FastVector.size方法代碼示例

本文整理匯總了Java中weka.core.FastVector.size方法的典型用法代碼示例。如果您正苦於以下問題:Java FastVector.size方法的具體用法?Java FastVector.size怎麽用?Java FastVector.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在weka.core.FastVector的用法示例。


在下文中一共展示了FastVector.size方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ClassPanel

import weka.core.FastVector; //導入方法依賴的package包/類
public ClassPanel(Color background) {
   m_backgroundColor = background;
   
   /** Set up some default colours */
   m_colorList = new FastVector(10);
   for (int noa = m_colorList.size(); noa < 10; noa++) {
     Color pc = m_DefaultColors[noa % 10];
     int ija =  noa / 10;
     ija *= 2; 
     for (int j=0;j<ija;j++) {
pc = pc.darker();
     }

     m_colorList.addElement(pc);
   }
 }
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:17,代碼來源:ClassPanel.java

示例2: DelValueAction

import weka.core.FastVector; //導入方法依賴的package包/類
DelValueAction(int nTargetNode, String sValue) {
	try {
		m_nTargetNode = nTargetNode;
		m_sValue = sValue;
		m_att = m_Instances.attribute(nTargetNode);
		SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
		m_CPT = (Estimator[]) so.getObject();
		;
		m_children = new FastVector();
		for (int iNode = 0; iNode < getNrOfNodes(); iNode++) {
			if (m_ParentSets[iNode].contains(nTargetNode)) {
				m_children.addElement(iNode);
			}
		}
		m_childAtts = new Estimator[m_children.size()][];
		for (int iChild = 0; iChild < m_children.size(); iChild++) {
			int nChild = (Integer) m_children.elementAt(iChild);
			m_childAtts[iChild] = m_Distributions[nChild];
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:24,代碼來源:EditableBayesNet.java

示例3: alignRight

import weka.core.FastVector; //導入方法依賴的package包/類
/** align set of nodes with the right most node in the list
 * @param nodes list of indexes of nodes to align
 */
public void alignRight(FastVector nodes) {
	// update undo stack
	if (m_bNeedsUndoAction) {
		addUndoAction(new alignRightAction(nodes));
	}
	int nMaxX = -1;
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nX = getPositionX((Integer) nodes.elementAt(iNode));
		if (nX > nMaxX || iNode == 0) {
			nMaxX = nX;
		}
	}
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nNode = (Integer) nodes.elementAt(iNode);
		m_nPositionX.setElementAt(nMaxX, nNode);
	}
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:21,代碼來源:EditableBayesNet.java

示例4: alignTop

import weka.core.FastVector; //導入方法依賴的package包/類
/** align set of nodes with the top most node in the list
 * @param nodes list of indexes of nodes to align
 */
public void alignTop(FastVector nodes) {
	// update undo stack
	if (m_bNeedsUndoAction) {
		addUndoAction(new alignTopAction(nodes));
	}
	int nMinY = -1;
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nY = getPositionY((Integer) nodes.elementAt(iNode));
		if (nY < nMinY || iNode == 0) {
			nMinY = nY;
		}
	}
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nNode = (Integer) nodes.elementAt(iNode);
		m_nPositionY.setElementAt(nMinY, nNode);
	}
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:21,代碼來源:EditableBayesNet.java

示例5: prunePredictions

import weka.core.FastVector; //導入方法依賴的package包/類
/**
 * Randomly downsample the predictions
 * 
 * @param retain the fraction of the predictions to retain
 * @param seed the random seed to use
 * @throws Exception if a problem occurs
 */
@SuppressWarnings({ "cast", "deprecation" })
public void prunePredictions(double retain, long seed) throws Exception {
  if (m_Predictions == null || m_Predictions.size() == 0 || retain == 1) {
    return;
  }

  int numToRetain = (int) (retain * m_Predictions.size());
  if (numToRetain < 1) {
    numToRetain = 1;
  }

  Random r = new Random(seed);
  for (int i = 0; i < 50; i++) {
    r.nextInt();
  }

  FastVector<Prediction> downSampled =
    new FastVector<Prediction>(numToRetain);
  FastVector<Prediction> tmpV = new FastVector<Prediction>();
  tmpV.addAll(m_Predictions);
  for (int i = m_Predictions.size() - 1; i >= 0; i--) {
    int index = r.nextInt(i + 1);
    // downSampled.addElement(m_Predictions.elementAt(index));

    // cast necessary for 3.7.10 compatibility
    downSampled.add(tmpV.get(index));
    // downSampled.add(m_Predictions.get(index));

    if (downSampled.size() == numToRetain) {
      break;
    }

    // m_Predictions.swap(i, index);
    tmpV.swap(i, index);
  }

  m_Predictions = downSampled;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:46,代碼來源:AggregateableEvaluationWithPriors.java

示例6: AddArcAction

import weka.core.FastVector; //導入方法依賴的package包/類
AddArcAction(int nParent, FastVector children) {
	try {
		m_nParent = nParent;
		m_children = new FastVector();
		m_CPT = new Estimator[children.size()][];
		for (int iChild = 0; iChild < children.size(); iChild++) {
			int nChild = (Integer) children.elementAt(iChild);
			m_children.addElement(nChild);
			SerializedObject so = new SerializedObject(m_Distributions[nChild]);
			m_CPT[iChild] = (Estimator[]) so.getObject();
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:16,代碼來源:EditableBayesNet.java

示例7: setConnectPoints

import weka.core.FastVector; //導入方法依賴的package包/類
/**
 * Set whether consecutive points should be connected by lines
 * @param cp a FastVector of boolean specifying which points should be
 * connected to their preceeding neighbour.
 */
public void setConnectPoints(FastVector cp) throws Exception {
  if (cp.size() != m_plotInstances.numInstances()) {
    throw new Exception("PlotData2D: connect points array must have the "
	  +"same number of entries as number of data points!");
  }
  //System.err.println("Setting connect points ");
  m_shapeSize = new int [cp.size()];
  for (int i = 0; i < cp.size(); i++) {
    m_connectPoints[i] = ((Boolean)cp.elementAt(i)).booleanValue();
  }
  m_connectPoints[0] = false;
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:18,代碼來源:PlotData2D.java

示例8: predictionsToString

import weka.core.FastVector; //導入方法依賴的package包/類
/**
 * Returns a string containing all the predictions.
 *
 * @param predictions a <code>FastVector</code> containing the predictions
 * @return a <code>String</code> representing the vector of predictions.
 */
protected String predictionsToString(FastVector predictions) {
  StringBuffer sb = new StringBuffer();
  sb.append(predictions.size()).append(" predictions\n");
  for (int i = 0; i < predictions.size(); i++) {
    sb.append(predictions.elementAt(i)).append('\n');
  }
  return sb.toString();
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:15,代碼來源:SerializedClassifierTest.java

示例9: predictionsToString

import weka.core.FastVector; //導入方法依賴的package包/類
/**
 * Returns a string containing all the tokens.
 *
 * @param tokens 	a <code>FastVector</code> containing the tokens
 * @return 		a <code>String</code> representing the vector of tokens.
 */
protected String predictionsToString(FastVector tokens) {
  StringBuffer sb = new StringBuffer();
  
  sb.append(tokens.size()).append(" tokens\n");
  for (int i = 0; i < tokens.size(); i++)
    sb.append(tokens.elementAt(i)).append('\n');
  
  return sb.toString();
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:16,代碼來源:AbstractTokenizerTest.java

示例10: pruneItemSets

import weka.core.FastVector; //導入方法依賴的package包/類
/**
  * Prunes a set of (k)-item sets using the given (k-1)-item sets.
  *
  * @param toPrune the set of (k)-item sets to be pruned
  * @param kMinusOne the (k-1)-item sets to be used for pruning
  * @return the pruned set of item sets
  */
 public static FastVector pruneItemSets(FastVector toPrune, Hashtable kMinusOne){

   FastVector newVector = new FastVector(toPrune.size());
   int help, j;

  
   for (int i = 0; i < toPrune.size(); i++) {
     LabeledItemSet current = (LabeledItemSet)toPrune.elementAt(i);
     
     for (j = 0; j < current.m_items.length; j++){
      if (current.m_items[j] != -1) {
	  help = current.m_items[j];
	  current.m_items[j] = -1;
	  if(kMinusOne.get(current) != null && (current.m_classLabel == (((Integer)kMinusOne.get(current)).intValue())))
	      current.m_items[j] = help;
                 else{
	      current.m_items[j] = help;
	      break;
	  } 
  }
     }
     if (j == current.m_items.length) 
newVector.addElement(current);
   }
   return newVector;
 }
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:34,代碼來源:LabeledItemSet.java

示例11: deleteItemSets

import weka.core.FastVector; //導入方法依賴的package包/類
/** Deletes all item sets that don't have minimum support.
  * @return the reduced set of item sets
  * @param maxSupport the maximum support
  * @param itemSets the set of item sets to be pruned
  * @param minSupport the minimum number of transactions to be covered
  */
 public static FastVector deleteItemSets(FastVector itemSets, 
				  int minSupport,
				  int maxSupport) {

   FastVector newVector = new FastVector(itemSets.size());

   for (int i = 0; i < itemSets.size(); i++) {
     ItemSet current = (ItemSet)itemSets.elementAt(i);
     if ((current.m_counter >= minSupport) 
  && (current.m_counter <= maxSupport))
newVector.addElement(current);
   }
   return newVector;
 }
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:21,代碼來源:ItemSet.java

示例12: getHashtable

import weka.core.FastVector; //導入方法依賴的package包/類
/**
 * Return a hashtable filled with the given item sets.
 *
 * @param itemSets the set of item sets to be used for filling the hash table
 * @param initialSize the initial size of the hashtable
 * @return the generated hashtable
 */
public static Hashtable getHashtable(FastVector itemSets, int initialSize) {

  Hashtable hashtable = new Hashtable(initialSize);

  for (int i = 0; i < itemSets.size(); i++) {
    ItemSet current = (ItemSet)itemSets.elementAt(i);
    hashtable.put(current, new Integer(current.m_counter));
  }
  return hashtable;
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:18,代碼來源:ItemSet.java

示例13: setInputFormat

import weka.core.FastVector; //導入方法依賴的package包/類
/**
  * Sets the format of the input instances.
  *
  * @param instanceInfo an Instances object containing the input instance
  * structure (any instances contained in the object are ignored - only the
  * structure is required).
  * @return true if the outputFormat may be collected immediately
  * @throws Exception if the format couldn't be set successfully
  */
 public boolean setInputFormat(Instances instanceInfo) throws Exception {

   super.setInputFormat(instanceInfo);
   
   m_SelectCols.setUpper(instanceInfo.numAttributes() - 1);

   // Create the output buffer
   FastVector attributes = new FastVector();
   int outputClass = -1;
   m_SelectedAttributes = m_SelectCols.getSelection();
   for (int i = 0; i < m_SelectedAttributes.length; i++) {
     int current = m_SelectedAttributes[i];
     if (instanceInfo.classIndex() == current) {
outputClass = attributes.size();
     }
     Attribute keep = (Attribute)instanceInfo.attribute(current).copy();
     attributes.addElement(keep);
   }
   //initInputLocators(instanceInfo, m_SelectedAttributes);
   initInputLocators(getInputFormat(), m_SelectedAttributes);
   Instances outputFormat = new Instances(instanceInfo.relationName(),
				   attributes, 0); 
   outputFormat.setClassIndex(outputClass);
   setOutputFormat(outputFormat);
   return true;
 }
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:36,代碼來源:Remove.java

示例14: SetGroupPositionAction

import weka.core.FastVector; //導入方法依賴的package包/類
SetGroupPositionAction(FastVector nodes, int dX, int dY) {
	m_nodes = new FastVector(nodes.size());
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		m_nodes.addElement(nodes.elementAt(iNode));
	}
	m_dX = dX;
	m_dY = dY;
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:9,代碼來源:EditableBayesNet.java

示例15: alignAction

import weka.core.FastVector; //導入方法依賴的package包/類
alignAction(FastVector nodes) {
	m_nodes = new FastVector(nodes.size());
	m_posX = new FastVector(nodes.size());
	m_posY = new FastVector(nodes.size());
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nNode = (Integer) nodes.elementAt(iNode);
		m_nodes.addElement(nNode);
		m_posX.addElement(getPositionX(nNode));
		m_posY.addElement(getPositionY(nNode));
	}
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:12,代碼來源:EditableBayesNet.java


注:本文中的weka.core.FastVector.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。