当前位置: 首页>>代码示例>>Java>>正文


Java FastVector.elementAt方法代码示例

本文整理汇总了Java中weka.core.FastVector.elementAt方法的典型用法代码示例。如果您正苦于以下问题:Java FastVector.elementAt方法的具体用法?Java FastVector.elementAt怎么用?Java FastVector.elementAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weka.core.FastVector的用法示例。


在下文中一共展示了FastVector.elementAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: input

import weka.core.FastVector; //导入方法依赖的package包/类
/**
  * Input an instance for filtering. Filter requires all
  * training instances be read before producing output.
  *
  * @param instance the input instance.
  * @return true if the filtered instance may now be
  * collected with output().
  * @throws IllegalStateException if no input structure has been defined.
  */
 public boolean input(Instance instance) throws Exception {

   if (getInputFormat() == null) {
     throw new IllegalStateException("No input instance format defined");
   }
   if (m_NewBatch) {
     resetQueue();
     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;
   } else {
     bufferInput(instance);
     return false;
   }
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:33,代码来源:StringToWordVector.java

示例2: spaceHorizontal

import weka.core.FastVector; //导入方法依赖的package包/类
/** space out set of nodes evenly between left and right most node in the list
 * @param nodes list of indexes of nodes to space out
 */
public void spaceHorizontal(FastVector nodes) {
	// update undo stack
	if (m_bNeedsUndoAction) {
		addUndoAction(new spaceHorizontalAction(nodes));
	}
	int nMinX = -1;
	int nMaxX = -1;
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nX = getPositionX((Integer) nodes.elementAt(iNode));
		if (nX < nMinX || iNode == 0) {
			nMinX = nX;
		}
		if (nX > nMaxX || iNode == 0) {
			nMaxX = nX;
		}
	}
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nNode = (Integer) nodes.elementAt(iNode);
		m_nPositionX.setElementAt((int) (nMinX + iNode * (nMaxX - nMinX) / (nodes.size() - 1.0)), nNode);
	}
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:25,代码来源:EditableBayesNet.java

示例3: 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

示例4: getDefinition

import weka.core.FastVector; //导入方法依赖的package包/类
Element getDefinition(Document doc, String sName) throws Exception {
	//NodeList nodelist = selectNodeList(doc, "//DEFINITION[normalize-space(FOR/text())=\"" + sName + "\"]");

	NodeList nodelist = doc.getElementsByTagName("DEFINITION");
	for (int iNode = 0; iNode < nodelist.getLength(); iNode++) {
		Node node = nodelist.item(iNode);
		FastVector list = selectElements(node, "FOR");
		if (list.size() > 0) {
			Node forNode = (Node) list.elementAt(0);
			if (getContent((Element) forNode).trim().equals(sName)) {
				return (Element) node;
			}
		}
	}
	throw new Exception("Could not find definition for ((" + sName + "))");
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:17,代码来源:BIFReader.java

示例5: 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

示例6: rmCoveredBySuccessives

import weka.core.FastVector; //导入方法依赖的package包/类
/**
  * Static utility function to count the data covered by the 
  * rules after the given index in the given rules, and then
  * remove them.  It returns the data not covered by the
  * successive rules.
  *
  * @param data the data to be processed
  * @param rules the ruleset
  * @param index the given index
  * @return the data after processing
  */
 public static Instances rmCoveredBySuccessives(Instances data, FastVector rules, int index){
   Instances rt = new Instances(data, 0);

   for(int i=0; i < data.numInstances(); i++){
     Instance datum = data.instance(i);
     boolean covered = false;	    
    
     for(int j=index+1; j<rules.size();j++){
Rule rule = (Rule)rules.elementAt(j);
if(rule.covers(datum)){
  covered = true;
  break;
}
     }

     if(!covered)
rt.add(datum);
   }	
   return rt;
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:32,代码来源:RuleStats.java

示例7: centerHorizontal

import weka.core.FastVector; //导入方法依赖的package包/类
/** center set of nodes half way between left and right most node in the list
 * @param nodes list of indexes of nodes to center
 */
public void centerHorizontal(FastVector nodes) {
	// update undo stack
	if (m_bNeedsUndoAction) {
		addUndoAction(new centerHorizontalAction(nodes));
	}
	int nMinY = -1;
	int nMaxY = -1;
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nY = getPositionY((Integer) nodes.elementAt(iNode));
		if (nY < nMinY || iNode == 0) {
			nMinY = nY;
		}
		if (nY > nMaxY || iNode == 0) {
			nMaxY = nY;
		}
	}
	for (int iNode = 0; iNode < nodes.size(); iNode++) {
		int nNode = (Integer) nodes.elementAt(iNode);
		m_nPositionY.setElementAt((nMinY + nMaxY) / 2, nNode);
	}
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:25,代码来源:EditableBayesNet.java

示例8: deleteItemSets

import weka.core.FastVector; //导入方法依赖的package包/类
/**
   * Deletes all item sets that don't have minimum support and have more than maximum 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++) {
    LabeledItemSet current = (LabeledItemSet)itemSets.elementAt(i);
    if ((current.m_ruleSupCounter >= minSupport) 
 && (current.m_ruleSupCounter <= maxSupport))
          newVector.addElement(current);
  }
  return newVector;
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:22,代码来源:LabeledItemSet.java

示例9: 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++) {
    LabeledItemSet current = (LabeledItemSet)itemSets.elementAt(i);
    hashtable.put(current, new Integer(current.m_classLabel));
  }
 
  return hashtable;
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:18,代码来源:LabeledItemSet.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: 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

示例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: saveVisibleInstances

import weka.core.FastVector; //导入方法依赖的package包/类
/**
  * Save the currently visible set of instances to a file
  */
 private void saveVisibleInstances() {
   FastVector plots = m_plot.m_plot2D.getPlots();
   if (plots != null) {
     PlotData2D master = (PlotData2D)plots.elementAt(0);
     Instances saveInsts = new Instances(master.getPlotInstances());
     for (int i = 1; i < plots.size(); i++) {
PlotData2D temp = (PlotData2D)plots.elementAt(i);
Instances addInsts = temp.getPlotInstances();
for (int j = 0; j < addInsts.numInstances(); j++) {
  saveInsts.add(addInsts.instance(j));
}
     }
     try {
int returnVal = m_FileChooser.showSaveDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
  File sFile = m_FileChooser.getSelectedFile();
  if (!sFile.getName().toLowerCase().
      endsWith(Instances.FILE_EXTENSION)) {
    sFile = new File(sFile.getParent(), sFile.getName() 
		     + Instances.FILE_EXTENSION);
  }
  File selected = sFile;
  Writer w = new BufferedWriter(new FileWriter(selected));
  w.write(saveInsts.toString());
  w.close();
}
     } catch (Exception ex) {
ex.printStackTrace();
     }
   }
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:35,代码来源:VisualizePanel.java

示例14: getProbabilities

import weka.core.FastVector; //导入方法依赖的package包/类
/**
 * 
 * @param predictions the predictions to use
 * @param classIndex the class index
 * @return the probabilities
 */
private double [] getProbabilities(FastVector predictions, int classIndex) {

  // sort by predicted probability of the desired class.
  double [] probs = new double [predictions.size()];
  for (int i = 0; i < probs.length; i++) {
    NominalPrediction pred = (NominalPrediction)predictions.elementAt(i);
    probs[i] = pred.distribution()[classIndex];
  }
  return probs;
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:17,代码来源:ThresholdCurve.java

示例15: getMargins

import weka.core.FastVector; //导入方法依赖的package包/类
/**
 * Pulls all the margin values out of a vector of NominalPredictions.
 *
 * @param predictions a FastVector containing NominalPredictions
 * @return an array of margin values.
 */
private double [] getMargins(FastVector predictions) {

  // sort by predicted probability of the desired class.
  double [] margins = new double [predictions.size()];
  for (int i = 0; i < margins.length; i++) {
    NominalPrediction pred = (NominalPrediction)predictions.elementAt(i);
    margins[i] = pred.margin();
  }
  return margins;
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:17,代码来源:MarginCurve.java


注:本文中的weka.core.FastVector.elementAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。