@@ -16,10 +16,10 @@ namespace Microsoft.ML.Data
16
16
/// class numbers, etc. For example, in multi-class classification, the label is typically
17
17
/// a class number which is naturally a KeyType.
18
18
///
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.
20
20
///
21
21
/// 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
23
23
/// the representational values are 1-5001. The representation value zero is reserved
24
24
/// to mean a missing value (similar to NaN).
25
25
/// </summary>
@@ -53,13 +53,20 @@ public static bool IsValidDataType(Type type)
53
53
54
54
/// <summary>
55
55
/// <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
57
57
/// vector with 1 in slot (id - 1) and 0 in all other slots. This is the standard "indicator"
58
58
/// 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"/> ).
60
60
/// </summary>
61
61
public ulong Count { get ; }
62
62
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>
63
70
public override bool Equals ( DataViewType other )
64
71
{
65
72
if ( other == this )
@@ -74,16 +81,31 @@ public override bool Equals(DataViewType other)
74
81
return true ;
75
82
}
76
83
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>
77
91
public override bool Equals ( object other )
78
92
{
79
93
return other is DataViewType tmp && Equals ( tmp ) ;
80
94
}
81
95
96
+ /// <summary>
97
+ /// Retrieves the hash code.
98
+ /// </summary>
99
+ /// <returns>An integer representing the hash code.</returns>
82
100
public override int GetHashCode ( )
83
101
{
84
102
return Hashing . CombinedHash ( RawType . GetHashCode ( ) , Count ) ;
85
103
}
86
104
105
+ /// <summary>
106
+ /// The string representation of the <see cref="KeyType"/>.
107
+ /// </summary>
108
+ /// <returns>A formatted string.</returns>
87
109
public override string ToString ( )
88
110
{
89
111
InternalDataKind rawKind = this . GetRawKind ( ) ;
0 commit comments