예제 #1
0
		/// <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());
		}
예제 #2
0
		/// <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);
		}
예제 #3
0
		/// <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());
		}
예제 #4
0
		/// <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());
		}
예제 #5
0
		/// <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());
		}
예제 #6
0
		/// <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());
		}
예제 #7
0
		/// <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);
		}
예제 #8
0
		/// <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);
		}