本文整理了Java中cc.mallet.types.InstanceList.cloneEmpty()
方法的一些代码示例,展示了InstanceList.cloneEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InstanceList.cloneEmpty()
方法的具体详情如下:
包路径:cc.mallet.types.InstanceList
类名称:InstanceList
方法名:cloneEmpty
暂无
代码示例来源:origin: com.github.steveash.mallet/mallet
public InstanceList cloneEmpty () {
InstanceList[] newLists = new InstanceList[this.lists.length];
for (int i = 0; i < this.lists.length; i++) {
newLists[i] = this.lists[i].cloneEmpty ();
}
return new MultiInstanceList (newLists);
}
代码示例来源:origin: cc.mallet/mallet
public InstanceList cloneEmpty () {
InstanceList[] newLists = new InstanceList[this.lists.length];
for (int i = 0; i < this.lists.length; i++) {
newLists[i] = this.lists[i].cloneEmpty ();
}
return new MultiInstanceList (newLists);
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public InstanceList cloneEmpty () {
InstanceList[] newLists = new InstanceList[this.lists.length];
for (int i = 0; i < this.lists.length; i++) {
newLists[i] = this.lists[i].cloneEmpty ();
}
return new MultiInstanceList (newLists);
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public InstanceList subList (int start, int end)
{
InstanceList other = this.cloneEmpty();
for (int i = start; i < end; i++) {
other.add (get (i));
}
return other;
}
代码示例来源:origin: cc.mallet/mallet
public InstanceList subList (int start, int end)
{
InstanceList other = this.cloneEmpty();
for (int i = start; i < end; i++) {
other.add (get (i));
}
return other;
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public InstanceList subList (int start, int end)
{
InstanceList other = this.cloneEmpty();
for (int i = start; i < end; i++) {
other.add (get (i));
}
return other;
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public InstanceList[] splitInOrder (int[] counts) {
InstanceList[] ret = new InstanceList[counts.length];
// Will leave ununsed instances if sum of counts[] != this.size()!
int idx = 0;
for (int num = 0; num < counts.length; num++){
ret[num] = cloneEmpty();
for (int i = 0; i < counts[num]; i++){
ret[num].add (get(idx)); // Transfer weights?
idx++;
}
}
return ret;
}
代码示例来源:origin: cc.mallet/mallet
public InstanceList[] splitInOrder (int[] counts) {
InstanceList[] ret = new InstanceList[counts.length];
// Will leave ununsed instances if sum of counts[] != this.size()!
int idx = 0;
for (int num = 0; num < counts.length; num++){
ret[num] = cloneEmpty();
for (int i = 0; i < counts[num]; i++){
ret[num].add (get(idx)); // Transfer weights?
idx++;
}
}
return ret;
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public InstanceList[] splitInOrder (int[] counts) {
InstanceList[] ret = new InstanceList[counts.length];
// Will leave ununsed instances if sum of counts[] != this.size()!
int idx = 0;
for (int num = 0; num < counts.length; num++){
ret[num] = cloneEmpty();
for (int i = 0; i < counts[num]; i++){
ret[num].add (get(idx)); // Transfer weights?
idx++;
}
}
return ret;
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public InstanceList sampleWithReplacement (java.util.Random r, int numSamples)
{
InstanceList ret = this.cloneEmpty();
for (int i = 0; i < numSamples; i++)
ret.add (this.get(r.nextInt(this.size())));
return ret;
}
代码示例来源:origin: cc.mallet/mallet
public InstanceList sampleWithReplacement (java.util.Random r, int numSamples)
{
InstanceList ret = this.cloneEmpty();
for (int i = 0; i < numSamples; i++)
ret.add (this.get(r.nextInt(this.size())));
return ret;
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public InstanceList sampleWithReplacement (java.util.Random r, int numSamples)
{
InstanceList ret = this.cloneEmpty();
for (int i = 0; i < numSamples; i++)
ret.add (this.get(r.nextInt(this.size())));
return ret;
}
代码示例来源:origin: cc.mallet/mallet
/** Returns a pair of new lists such that the first list in the pair contains
* every <code>m</code>th element of this list, starting with the first.
* The second list contains all remaining elements.
*/
public InstanceList[] splitInTwoByModulo (int m)
{
InstanceList[] ret = new InstanceList[2];
ret[0] = this.cloneEmpty();
ret[1] = this.cloneEmpty();
for (int i = 0; i < this.size(); i++) {
if (i % m == 0)
ret[0].add (this.get(i));
else
ret[1].add (this.get(i));
}
return ret;
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
/** Returns a pair of new lists such that the first list in the pair contains
* every <code>m</code>th element of this list, starting with the first.
* The second list contains all remaining elements.
*/
public InstanceList[] splitInTwoByModulo (int m)
{
InstanceList[] ret = new InstanceList[2];
ret[0] = this.cloneEmpty();
ret[1] = this.cloneEmpty();
for (int i = 0; i < this.size(); i++) {
if (i % m == 0)
ret[0].add (this.get(i));
else
ret[1].add (this.get(i));
}
return ret;
}
代码示例来源:origin: com.github.steveash.mallet/mallet
/** Returns a pair of new lists such that the first list in the pair contains
* every <code>m</code>th element of this list, starting with the first.
* The second list contains all remaining elements.
*/
public InstanceList[] splitInTwoByModulo (int m)
{
InstanceList[] ret = new InstanceList[2];
ret[0] = this.cloneEmpty();
ret[1] = this.cloneEmpty();
for (int i = 0; i < this.size(); i++) {
if (i % m == 0)
ret[0].add (this.get(i));
else
ret[1].add (this.get(i));
}
return ret;
}
代码示例来源:origin: cc.mallet/mallet
/** Chops this list into several sequential sublists.
* @param proportions A list of numbers corresponding to the proportion of
* elements in each returned sublist. If not already normalized to sum to 1.0, it will be normalized here.
* @return one <code>InstanceList</code> for each element of <code>proportions</code>
*/
public InstanceList[] splitInOrder (double[] proportions) {
InstanceList[] ret = new InstanceList[proportions.length];
double maxind[] = proportions.clone();
MatrixOps.normalize(maxind);
for (int i = 0; i < maxind.length; i++) {
ret[i] = this.cloneEmpty(); // Note that we are passing on featureSelection here.
if (i > 0)
maxind[i] += maxind[i-1];
}
for (int i = 0; i < maxind.length; i++) {
// Fill maxind[] with the highest instance index to go in each corresponding returned InstanceList
maxind[i] = Math.rint (maxind[i] * this.size());
}
for (int i = 0, j = 0; i < size(); i++) {
// This gives a slight bias toward putting an extra instance in the last InstanceList.
while (i >= maxind[j] && j < ret.length)
j++;
ret[j].add(this.get(i));
}
return ret;
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
/** Chops this list into several sequential sublists.
* @param proportions A list of numbers corresponding to the proportion of
* elements in each returned sublist. If not already normalized to sum to 1.0, it will be normalized here.
* @return one <code>InstanceList</code> for each element of <code>proportions</code>
*/
public InstanceList[] splitInOrder (double[] proportions) {
InstanceList[] ret = new InstanceList[proportions.length];
double maxind[] = proportions.clone();
MatrixOps.normalize(maxind);
for (int i = 0; i < maxind.length; i++) {
ret[i] = this.cloneEmpty(); // Note that we are passing on featureSelection here.
if (i > 0)
maxind[i] += maxind[i-1];
}
for (int i = 0; i < maxind.length; i++) {
// Fill maxind[] with the highest instance index to go in each corresponding returned InstanceList
maxind[i] = Math.rint (maxind[i] * this.size());
}
for (int i = 0, j = 0; i < size(); i++) {
// This gives a slight bias toward putting an extra instance in the last InstanceList.
while (i >= maxind[j] && j < ret.length)
j++;
ret[j].add(this.get(i));
}
return ret;
}
代码示例来源:origin: com.github.steveash.mallet/mallet
/** Chops this list into several sequential sublists.
* @param proportions A list of numbers corresponding to the proportion of
* elements in each returned sublist. If not already normalized to sum to 1.0, it will be normalized here.
* @return one <code>InstanceList</code> for each element of <code>proportions</code>
*/
public InstanceList[] splitInOrder (double[] proportions) {
InstanceList[] ret = new InstanceList[proportions.length];
double maxind[] = proportions.clone();
MatrixOps.normalize(maxind);
for (int i = 0; i < maxind.length; i++) {
ret[i] = this.cloneEmpty(); // Note that we are passing on featureSelection here.
if (i > 0)
maxind[i] += maxind[i-1];
}
for (int i = 0; i < maxind.length; i++) {
// Fill maxind[] with the highest instance index to go in each corresponding returned InstanceList
maxind[i] = Math.rint (maxind[i] * this.size());
}
for (int i = 0, j = 0; i < size(); i++) {
// This gives a slight bias toward putting an extra instance in the last InstanceList.
while (i >= maxind[j] && j < ret.length)
j++;
ret[j].add(this.get(i));
}
return ret;
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
private double optimizePAndComputeValue(InstanceList data, PRAuxClassifier q, double[][] base, double pGPV) {
InstanceList dataLabeled = data.cloneEmpty();
代码示例来源:origin: com.github.steveash.mallet/mallet
private double optimizePAndComputeValue(InstanceList data, PRAuxClassifier q, double[][] base, double pGPV) {
InstanceList dataLabeled = data.cloneEmpty();
内容来源于网络,如有侵权,请联系作者删除!