/// <summary> Returns the number of distinct values of a given attribute. /// Returns the number of instances if the attribute is a /// string attribute. The value 'missing' is not counted. /// /// </summary> /// <param name="att">the attribute /// </param> /// <returns> the number of distinct values of a given attribute /// </returns> public virtual int numDistinctValues(Attribute att) { return numDistinctValues(att.index()); }
/// <summary> Returns the kth-smallest attribute value of a numeric attribute. /// Note that calling this method will change the order of the data! /// /// </summary> /// <param name="att">the Attribute object /// </param> /// <param name="k">the value of k /// </param> /// <returns> the kth-smallest value /// </returns> public virtual double kthSmallestValue(Attribute att, int k) { return kthSmallestValue(att.index(), k); }
/// <summary> Returns the mean (mode) for a numeric (nominal) attribute as a /// floating-point value. Returns 0 if the attribute is neither /// nominal nor numeric. If all values are missing it returns zero. /// /// </summary> /// <param name="att">the attribute /// </param> /// <returns> the mean or the mode /// </returns> public virtual double meanOrMode(Attribute att) { return meanOrMode(att.index()); }
/// <summary> Removes all instances with missing values for a particular /// attribute from the dataset. /// /// </summary> /// <param name="att">the attribute /// </param> public virtual void deleteWithMissing(Attribute att) { deleteWithMissing(att.index()); }
/// <summary> Computes the variance for a numeric attribute. /// /// </summary> /// <param name="att">the numeric attribute /// </param> /// <returns> the variance if the attribute is numeric /// </returns> /// <exception cref="IllegalArgumentException">if the attribute is not numeric /// </exception> public virtual double variance(Attribute att) { return variance(att.index()); }
/// <summary> Sorts the instances based on an attribute. For numeric attributes, /// instances are sorted into ascending order. For nominal attributes, /// instances are sorted based on the attribute label ordering /// specified in the header. Instances with missing values for the /// attribute are placed at the end of the dataset. /// /// </summary> /// <param name="att">the attribute /// </param> public virtual void sort(Attribute att) { sort(att.index()); }
/// <summary> Renames the value of a nominal (or string) attribute value. This /// change only affects this dataset. /// /// </summary> /// <param name="att">the attribute /// </param> /// <param name="val">the value /// </param> /// <param name="name">the new name /// </param> public virtual void renameAttributeValue(Attribute att, System.String val, System.String name) { int v = att.indexOfValue(val); if (v == - 1) throw new System.ArgumentException(val + " not found"); renameAttributeValue(att.index(), v, name); }
/// <summary> Renames an attribute. This change only affects this /// dataset. /// /// </summary> /// <param name="att">the attribute /// </param> /// <param name="name">the new name /// </param> public virtual void renameAttribute(Attribute att, System.String name) { renameAttribute(att.index(), name); }