@@ -16,10 +16,10 @@ namespace Microsoft.ML.Data
1616 /// class numbers, etc. For example, in multi-class classification, the label is typically
1717 /// a class number which is naturally a KeyType.
1818 ///
19- /// KeyTypes have a cardinality (i.e., Count) that is strictly positive.
19+ /// KeyTypes have a cardinality (i.e., <see cref=" Count"/> ) that is strictly positive.
2020 ///
2121 /// Note that the underlying representation value does not necessarily match the logical value.
22- /// For example, if a KeyType has range 0-5000, then it has a Count of 5001, but
22+ /// For example, if a KeyType has range 0-5000, then it has a <see cref=" Count"/> of 5001, but
2323 /// the representational values are 1-5001. The representation value zero is reserved
2424 /// to mean a missing value (similar to NaN).
2525 /// </summary>
@@ -53,13 +53,20 @@ public static bool IsValidDataType(Type type)
5353
5454 /// <summary>
5555 /// <see cref="Count"/> is the cardinality of the <see cref="KeyType"/>. Note that such a key type can be converted to a
56- /// bit vector representation by mapping to a vector of length Count, with "id" mapped to a
56+ /// bit vector representation by mapping to a vector of length <see cref=" Count"/> , with "id" mapped to a
5757 /// vector with 1 in slot (id - 1) and 0 in all other slots. This is the standard "indicator"
5858 /// representation. Note that an id of 0 is used to represent the notion "none", which is
59- /// typically mapped, by for example, one-hot encoding, to a vector of all zeros (of length Count).
59+ /// typically mapped, by for example, one-hot encoding, to a vector of all zeros (of length <see cref=" Count"/> ).
6060 /// </summary>
6161 public ulong Count { get ; }
6262
63+ /// <summary>
64+ /// Determine if this <see cref="KeyType"/> object is equal to another <see cref="DataViewType"/> instance.
65+ /// Checks if the other item is the type of <see cref="KeyType"/>, if the <see cref="DataViewType.RawType"/>
66+ /// is the same, and if the <see cref="Count"/> is the same.
67+ /// </summary>
68+ /// <param name="other">The other object to compare against.</param>
69+ /// <returns><see langword="true" /> if both objects are equal, otherwise <see langword="false"/>.</returns>
6370 public override bool Equals ( DataViewType other )
6471 {
6572 if ( other == this )
@@ -74,16 +81,31 @@ public override bool Equals(DataViewType other)
7481 return true ;
7582 }
7683
84+ /// <summary>
85+ /// Determine if a <see cref="KeyType"/> instance is equal to another <see cref="KeyType"/> instance.
86+ /// Checks if any object is the type of <see cref="KeyType"/>, if the <see cref="DataViewType.RawType"/>
87+ /// is the same, and if the <see cref="Count"/> is the same.
88+ /// </summary>
89+ /// <param name="other">The other object to compare against.</param>
90+ /// <returns><see langword="true" /> if both objects are equal, otherwise <see langword="false"/>.</returns>
7791 public override bool Equals ( object other )
7892 {
7993 return other is DataViewType tmp && Equals ( tmp ) ;
8094 }
8195
96+ /// <summary>
97+ /// Retrieves the hash code.
98+ /// </summary>
99+ /// <returns>An integer representing the hash code.</returns>
82100 public override int GetHashCode ( )
83101 {
84102 return Hashing . CombinedHash ( RawType . GetHashCode ( ) , Count ) ;
85103 }
86104
105+ /// <summary>
106+ /// The string representation of the <see cref="KeyType"/>.
107+ /// </summary>
108+ /// <returns>A formatted string.</returns>
87109 public override string ToString ( )
88110 {
89111 InternalDataKind rawKind = this . GetRawKind ( ) ;
0 commit comments