cc.mallet.types.InstanceList.shallowClone()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中cc.mallet.types.InstanceList.shallowClone()方法的一些代码示例,展示了InstanceList.shallowClone()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InstanceList.shallowClone()方法的具体详情如下:
包路径:cc.mallet.types.InstanceList
类名称:InstanceList
方法名:shallowClone

InstanceList.shallowClone介绍

暂无

代码示例

代码示例来源:origin: com.github.steveash.mallet/mallet

public Object clone ()
{
  return shallowClone();
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public Object clone ()
{
  return shallowClone();
}

代码示例来源:origin: cc.mallet/mallet

public Object clone ()
{
  return shallowClone();
}

代码示例来源:origin: cc.mallet/mallet

public InstanceList shallowClone () {
  InstanceList[] newLists = new InstanceList[this.lists.length];
  for (int i = 0; i < this.lists.length; i++) {
    newLists[i] = this.lists[i].shallowClone ();
  }
  
  return new MultiInstanceList (newLists);
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public InstanceList shallowClone () {
  InstanceList[] newLists = new InstanceList[this.lists.length];
  for (int i = 0; i < this.lists.length; i++) {
    newLists[i] = this.lists[i].shallowClone ();
  }
  
  return new MultiInstanceList (newLists);
}

代码示例来源:origin: com.github.steveash.mallet/mallet

public InstanceList shallowClone () {
  InstanceList[] newLists = new InstanceList[this.lists.length];
  for (int i = 0; i < this.lists.length; i++) {
    newLists[i] = this.lists[i].shallowClone ();
  }
  
  return new MultiInstanceList (newLists);
}

代码示例来源:origin: ch.epfl.bbp.nlp/bluima_regions

/**
 * @param _nfolds
 *            number of folds to split InstanceList into
 * @param seed
 *            seed for random number used to split InstanceList
 */
public DocumentCrossValidationIterator(InstanceList ilist, int _nfolds,
    int seed) {
  assert (_nfolds > 0) : "nfolds: " + nfolds;
  this.nfolds = _nfolds;
  this.index = 0;
  this.pipe = ilist.pipe;
  // group instances by pubmed id
  instanceArticles = create();
  Iterator<Instance> iit = ilist.shallowClone().iterator();
  while (iit.hasNext()) {
    Instance instance = iit.next();
    int pmId = parseInt(instance.name.toString().split("__")[0]);
    instanceArticles.put(pmId, instance);
  }
  folds = split(new java.util.Random(seed), _nfolds);
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

/**
 * Shuffles the elements of this list among several smaller lists.
 * @param proportions A list of numbers (not necessarily summing to 1) which,
 * when normalized, correspond to the proportion of elements in each returned
 * sublist.  This method (and all the split methods) do not transfer the Instance
 * weights to the resulting InstanceLists.
 * @param r The source of randomness to use in shuffling.
 * @return one <code>InstanceList</code> for each element of <code>proportions</code>
 */
public InstanceList[] split (java.util.Random r, double[] proportions) {
  InstanceList shuffled = this.shallowClone();
  shuffled.shuffle (r);
  return shuffled.splitInOrder(proportions);
}

代码示例来源:origin: cc.mallet/mallet

/**
 * Shuffles the elements of this list among several smaller lists.
 * @param proportions A list of numbers (not necessarily summing to 1) which,
 * when normalized, correspond to the proportion of elements in each returned
 * sublist.  This method (and all the split methods) do not transfer the Instance
 * weights to the resulting InstanceLists.
 * @param r The source of randomness to use in shuffling.
 * @return one <code>InstanceList</code> for each element of <code>proportions</code>
 */
public InstanceList[] split (java.util.Random r, double[] proportions) {
  InstanceList shuffled = this.shallowClone();
  shuffled.shuffle (r);
  return shuffled.splitInOrder(proportions);
}

代码示例来源:origin: com.github.steveash.mallet/mallet

/**
 * Shuffles the elements of this list among several smaller lists.
 * @param proportions A list of numbers (not necessarily summing to 1) which,
 * when normalized, correspond to the proportion of elements in each returned
 * sublist.  This method (and all the split methods) do not transfer the Instance
 * weights to the resulting InstanceLists.
 * @param r The source of randomness to use in shuffling.
 * @return one <code>InstanceList</code> for each element of <code>proportions</code>
 */
public InstanceList[] split (java.util.Random r, double[] proportions) {
  InstanceList shuffled = this.shallowClone();
  shuffled.shuffle (r);
  return shuffled.splitInOrder(proportions);
}

代码示例来源:origin: cc.mallet/mallet

/**
 * Returns the next training/testing split.
 * @return A pair of lists, where <code>InstanceList[0]</code> is the larger split (training)
 *         and <code>InstanceList[1]</code> is the smaller split (testing)
 */
public InstanceList[] nextSplit () {
  InstanceList[] ret = new InstanceList[2];
  ret[0] = new InstanceList (pipe);
  for (int i=0; i < folds.length; i++) {
    if (i==index)
      continue;
    Iterator<Instance> iter = folds[i].iterator();
    while (iter.hasNext()) 
      ret[0].add (iter.next());									
  }
  ret[1] = folds[index].shallowClone();
  index++;
  return ret;
}

代码示例来源:origin: ch.epfl.bbp.nlp/bluima_regions

/**
 * Returns the next training/testing split.
 * 
 * @return A pair of lists, where <code>InstanceList[0]</code> is the larger
 *         split (training) and <code>InstanceList[1]</code> is the smaller
 *         split (testing)
 */
public InstanceList[] nextSplit() {
  InstanceList[] ret = new InstanceList[2];
  ret[0] = new InstanceList(pipe);
  for (int i = 0; i < folds.length; i++) {
    if (i == index)
      continue;
    Iterator<Instance> iter = folds[i].iterator();
    while (iter.hasNext())
      ret[0].add(iter.next());
  }
  ret[1] = folds[index].shallowClone();
  index++;
  return ret;
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

/**
 * Returns the next training/testing split.
 * @return A pair of lists, where <code>InstanceList[0]</code> is the larger split (training)
 *         and <code>InstanceList[1]</code> is the smaller split (testing)
 */
public InstanceList[] nextSplit () {
  InstanceList[] ret = new InstanceList[2];
  ret[0] = new InstanceList (pipe);
  for (int i=0; i < folds.length; i++) {
    if (i==index)
      continue;
    Iterator<Instance> iter = folds[i].iterator();
    while (iter.hasNext()) 
      ret[0].add (iter.next());									
  }
  ret[1] = folds[index].shallowClone();
  index++;
  return ret;
}

代码示例来源:origin: com.github.steveash.mallet/mallet

/**
 * Returns the next training/testing split.
 * @return A pair of lists, where <code>InstanceList[0]</code> is the larger split (training)
 *         and <code>InstanceList[1]</code> is the smaller split (testing)
 */
public InstanceList[] nextSplit () {
  InstanceList[] ret = new InstanceList[2];
  ret[0] = new InstanceList (pipe);
  for (int i=0; i < folds.length; i++) {
    if (i==index)
      continue;
    Iterator<Instance> iter = folds[i].iterator();
    while (iter.hasNext()) 
      ret[0].add (iter.next());									
  }
  ret[1] = folds[index].shallowClone();
  index++;
  return ret;
}

代码示例来源:origin: cc.mallet/mallet

Randoms r)
ilist = documents.shallowClone();
numTypes = ilist.getDataAlphabet().size ();
int numDocs = ilist.size();

代码示例来源:origin: com.github.steveash.mallet/mallet

Randoms r)
ilist = documents.shallowClone();
numTypes = ilist.getDataAlphabet().size ();
int numDocs = ilist.size();

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

Randoms r)
ilist = documents.shallowClone();
numTypes = ilist.getDataAlphabet().size ();
int numDocs = ilist.size();

相关文章

微信公众号

最新文章

更多