Package smile.data
Class AttributeVector
- java.lang.Object
-
- smile.data.AttributeVector
-
public class AttributeVector extends java.lang.ObjectA vector with attribute information.- Author:
- Haifeng Li
-
-
Constructor Summary
Constructors Constructor Description AttributeVector(Attribute attribute, double[] vector)Constructor.AttributeVector(Attribute attribute, double[] vector, java.lang.String[] names)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attributeattribute()Returns the attribute.java.lang.Stringhead(int n)Shows the first few rows.java.lang.String[]names()Returns the name vector.intsize()Returns the vector size.AttributeVectorsummary()Returns statistic summary.java.lang.Stringtail(int n)Shows the last few rows.java.lang.StringtoString()java.lang.StringtoString(int from, int to)Stringify the vector.double[]vector()Returns the data vector.
-
-
-
Constructor Detail
-
AttributeVector
public AttributeVector(Attribute attribute, double[] vector)
Constructor.- Parameters:
attribute- the attribute information.vector- the data vector.
-
AttributeVector
public AttributeVector(Attribute attribute, double[] vector, java.lang.String[] names)
Constructor.- Parameters:
attribute- the attribute information.vector- the data vector.names- optional names for each element.
-
-
Method Detail
-
attribute
public Attribute attribute()
Returns the attribute.
-
vector
public double[] vector()
Returns the data vector.
-
names
public java.lang.String[] names()
Returns the name vector.
-
size
public int size()
Returns the vector size.- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
head
public java.lang.String head(int n)
Shows the first few rows.
-
tail
public java.lang.String tail(int n)
Shows the last few rows.
-
toString
public java.lang.String toString(int from, int to)Stringify the vector.- Parameters:
from- starting row (inclusive)to- ending row (exclusive)
-
summary
public AttributeVector summary()
Returns statistic summary.
-
-