Class SimpleInstance<L>
- java.lang.Object
-
- ai.libs.jaicore.ml.core.dataset.standard.SimpleInstance<L>
-
- All Implemented Interfaces:
IAttributeArrayInstance,ILabeledAttributeArrayInstance<L>,ILabeledInstance<L>,INumericArrayInstance,INumericLabeledAttributeArrayInstance<L>,org.apache.commons.math3.ml.clustering.Clusterable
public class SimpleInstance<L> extends java.lang.Object implements INumericLabeledAttributeArrayInstance<L>
-
-
Constructor Summary
Constructors Constructor Description SimpleInstance(java.util.List<IAttributeValue<?>> attributeValues, L targetValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IAttributeValue<?>[]getAllAttributeValues()double[]getAsDoubleVector()Turns the instance into a double vector.IAttributeValue<java.lang.Double>getAttributeValue(int position)<T> IAttributeValue<T>getAttributeValueAtPosition(int position, java.lang.Class<T> type)Getter for the value of an attribute for the given position.intgetNumberOfAttributes()Getter for the number of attributes for the instance.LgetTargetValue()Getter for the value of the target attribute.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ai.libs.jaicore.ml.core.dataset.INumericArrayInstance
getPoint
-
-
-
-
Constructor Detail
-
SimpleInstance
public SimpleInstance(java.util.List<IAttributeValue<?>> attributeValues, L targetValue)
-
-
Method Detail
-
getAttributeValueAtPosition
public <T> IAttributeValue<T> getAttributeValueAtPosition(int position, java.lang.Class<T> type)
Description copied from interface:IAttributeArrayInstanceGetter for the value of an attribute for the given position.- Specified by:
getAttributeValueAtPositionin interfaceIAttributeArrayInstance- Parameters:
position- The position of the attribute within the instance.type- The type for which the attribute value shall be returned.- Returns:
- The attribute value for the position.
-
getTargetValue
public L getTargetValue()
Description copied from interface:ILabeledInstanceGetter for the value of the target attribute.- Specified by:
getTargetValuein interfaceILabeledInstance<L>- Returns:
- The value of the traget attribute.
-
getAsDoubleVector
public double[] getAsDoubleVector() throws ContainsNonNumericAttributesExceptionDescription copied from interface:INumericArrayInstanceTurns the instance into a double vector.- Specified by:
getAsDoubleVectorin interfaceINumericArrayInstance- Returns:
- The instance as a double vector.
- Throws:
ContainsNonNumericAttributesException- Thrown if the instance is to be converted into a double vector and still contains non-numeric attributes.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getAttributeValue
public IAttributeValue<java.lang.Double> getAttributeValue(int position)
- Specified by:
getAttributeValuein interfaceINumericArrayInstance
-
getAllAttributeValues
public IAttributeValue<?>[] getAllAttributeValues()
- Specified by:
getAllAttributeValuesin interfaceIAttributeArrayInstance
-
getNumberOfAttributes
public int getNumberOfAttributes()
Description copied from interface:IAttributeArrayInstanceGetter for the number of attributes for the instance.- Specified by:
getNumberOfAttributesin interfaceIAttributeArrayInstance- Returns:
- Number of attributes
-
-