org.apache.mahout.df.data
Class Instance

java.lang.Object
  extended by org.apache.mahout.df.data.Instance

public class Instance
extends java.lang.Object

Represents one data instance.


Field Summary
 int id
          instance unique id
 int label
          instance label code.
use Dataset.labels to get the real label value
 
Constructor Summary
Instance(int id, Vector attrs, int label)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 double get(int index)
          Return the attribute at the specified position
 int hashCode()
           
 void set(int index, double value)
          Set the value at the given index
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public final int id
instance unique id


label

public final int label
instance label code.
use Dataset.labels to get the real label value

Constructor Detail

Instance

public Instance(int id,
                Vector attrs,
                int label)
Method Detail

get

public double get(int index)
Return the attribute at the specified position

Parameters:
index - position of the attribute to retrieve
Returns:
value of the attribute

set

public void set(int index,
                double value)
Set the value at the given index

Parameters:
index -
value - a double value to set

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.