public boolean addAll (Collection<? extends Instance> instances) { for (Instance instance : instances) this.add (instance); return true; }
public boolean addAll (Collection<? extends Instance> instances) { for (Instance instance : instances) this.add (instance); return true; }
public boolean addAll (Collection<? extends Instance> instances) { for (Instance instance : instances) this.add (instance); return true; }
/** Constructs and appends an instance to this list, passing it through this * list's pipe. Default weight is 1.0. * @return <code>true</code> * @deprecated Use trainingset.add (new Instance(data,target,name,source)) instead. */ @Deprecated public boolean add (Object data, Object target, Object name, Object source) { return add (data, target, name, source, 1.0); }
public InstanceList subList (int start, int end) { InstanceList other = this.cloneEmpty(); for (int i = start; i < end; i++) { other.add (get (i)); } return other; }
public InstanceList subList (int start, int end) { InstanceList other = this.cloneEmpty(); for (int i = start; i < end; i++) { other.add (get (i)); } return other; }
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; }
public InstanceList subList (double proportion) { if (proportion > 1.0) throw new IllegalArgumentException ("proportion must by <= 1.0"); InstanceList other = (InstanceList) clone(); other.shuffle(new java.util.Random()); proportion *= other.size(); for (int i = 0; i < proportion; i++) other.add (get(i)); return other; }
/** * * @param i * @param j * @return A new {@link InstanceList} containing the two argument {@link Instance}s. */ public static InstanceList makeList (Instance i, Instance j) { InstanceList list = new InstanceList(new Noop(i.getDataAlphabet(), i.getTargetAlphabet())); list.add(i); list.add(j); return list; }
public InstanceList subList (double proportion) { if (proportion > 1.0) throw new IllegalArgumentException ("proportion must by <= 1.0"); InstanceList other = (InstanceList) clone(); other.shuffle(new java.util.Random()); proportion *= other.size(); for (int i = 0; i < proportion; i++) other.add (get(i)); return other; }
/** * * @param i * @param j * @return A new {@link InstanceList} containing the two argument {@link Instance}s. */ public static InstanceList makeList (Instance i, Instance j) { InstanceList list = new InstanceList(new Noop(i.getDataAlphabet(), i.getTargetAlphabet())); list.add(i); list.add(j); return list; }
/** * * @param i * @param j * @return A new {@link InstanceList} containing the two argument {@link Instance}s. */ public static InstanceList makeList (Instance i, Instance j) { InstanceList list = new InstanceList(new Noop(i.getDataAlphabet(), i.getTargetAlphabet())); list.add(i); list.add(j); return list; }
public InstanceList getInstances() { InstanceList ret = new InstanceList(m_ilist.getPipe()); for (int ii = 0; ii < m_instIndices.length; ii++) ret.add(m_ilist.get(m_instIndices[ii])); return ret; }
public InstanceList shallowClone () { InstanceList ret = this.cloneEmpty (); for (int i = 0; i < this.size (); i++) { ret.add (get (i)); } return ret; }
public InstanceList shallowClone () { InstanceList ret = this.cloneEmpty (); for (int i = 0; i < this.size (); i++) { ret.add (get (i)); } return ret; }
public Sequence pipeInput (Object input) { InstanceList all = new InstanceList (getFeaturePipe ()); all.add (input, null, null, null); return (Sequence) all.get (0).getData(); } }
public Sequence pipeInput (Object input) { InstanceList all = new InstanceList (getFeaturePipe ()); all.add (input, null, null, null); return (Sequence) all.get (0).getData(); } }
/** Return an list of instances with a particular label. */ public InstanceList getCluster(int label) { InstanceList cluster = new InstanceList(instances.getPipe()); for (int n=0 ; n<instances.size() ; n++) if (labels[n] == label) cluster.add(instances.get(n)); return cluster; }
/** Iterates over {@link Segment}s for only one {@link Instance}. */ public SegmentIterator (Transducer model, Instance instance, Object[] segmentStartTags, Object[] segmentContinueTags) { InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet())); ilist.add (instance); setSubIterator (model, ilist, segmentStartTags, segmentContinueTags); }
/** Iterates over {@link Segment}s for only one {@link Instance}. */ public SegmentIterator (Transducer model, Instance instance, Object[] segmentStartTags, Object[] segmentContinueTags) { InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet())); ilist.add (instance); setSubIterator (model, ilist, segmentStartTags, segmentContinueTags); }