From e9c28480e5ca00f959c24ccb659726d68e90aafa Mon Sep 17 00:00:00 2001 From: J W Date: Wed, 27 Feb 2019 12:49:42 -0500 Subject: [PATCH 1/4] Start updating method docs --- src/Microsoft.ML.Core/Data/KeyType.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Microsoft.ML.Core/Data/KeyType.cs b/src/Microsoft.ML.Core/Data/KeyType.cs index 877d2900fc..c3d85b6558 100644 --- a/src/Microsoft.ML.Core/Data/KeyType.cs +++ b/src/Microsoft.ML.Core/Data/KeyType.cs @@ -59,6 +59,13 @@ public static bool IsValidDataType(Type type) /// public ulong Count { get; } + /// + /// Determine if a KeyType instance is equal to another KeyType instance. + /// This checks if the other item is the type of KeyType, if the RawType + /// is the same, and if the Count is the same. + /// + /// + /// True if both objects are equal. public override bool Equals(DataViewType other) { if (other == this) From df5da3e6b8ef1decc8cf64684f86fd24836e408d Mon Sep 17 00:00:00 2001 From: J W Date: Wed, 27 Feb 2019 18:48:26 -0500 Subject: [PATCH 2/4] Add doc comments to KeyType --- src/Microsoft.ML.Core/Data/KeyType.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.ML.Core/Data/KeyType.cs b/src/Microsoft.ML.Core/Data/KeyType.cs index c3d85b6558..4636366a29 100644 --- a/src/Microsoft.ML.Core/Data/KeyType.cs +++ b/src/Microsoft.ML.Core/Data/KeyType.cs @@ -60,12 +60,12 @@ public static bool IsValidDataType(Type type) public ulong Count { get; } /// - /// Determine if a KeyType instance is equal to another KeyType instance. - /// This checks if the other item is the type of KeyType, if the RawType + /// Determine if a DataViewType object is equal to another KeyType instance. + /// Checks if the other item is the type of KeyType, if the RawType /// is the same, and if the Count is the same. /// - /// - /// True if both objects are equal. + /// The other object to compare against. + /// A boolean if both objects are equal or not. public override bool Equals(DataViewType other) { if (other == this) @@ -80,16 +80,31 @@ public override bool Equals(DataViewType other) return true; } + /// + /// Determine if a KeyType instance is equal to another KeyType instance. + /// Checks if any object is the type of KeyType, if the RawType + /// is the same, and if the Count is the same. + /// + /// The other object to compare against. + /// A boolean if both objects are equal or not. public override bool Equals(object other) { return other is DataViewType tmp && Equals(tmp); } + /// + /// Retrieves the hash code. + /// + /// An integer representing the hash code. public override int GetHashCode() { return Hashing.CombinedHash(RawType.GetHashCode(), Count); } + /// + /// The string representation of the KeyType. + /// + /// A formatted string. public override string ToString() { InternalDataKind rawKind = this.GetRawKind(); From 24ae1a7d7e58e72efc23d402d76d5a59c80450e4 Mon Sep 17 00:00:00 2001 From: J W Date: Thu, 28 Feb 2019 20:56:01 -0500 Subject: [PATCH 3/4] Updating for PR feedback --- src/Microsoft.ML.Core/Data/KeyType.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.ML.Core/Data/KeyType.cs b/src/Microsoft.ML.Core/Data/KeyType.cs index 4636366a29..89e060e026 100644 --- a/src/Microsoft.ML.Core/Data/KeyType.cs +++ b/src/Microsoft.ML.Core/Data/KeyType.cs @@ -60,12 +60,12 @@ public static bool IsValidDataType(Type type) public ulong Count { get; } /// - /// Determine if a DataViewType object is equal to another KeyType instance. - /// Checks if the other item is the type of KeyType, if the RawType + /// Determine if this object is equal to another instance. + /// Checks if the other item is the type of , if the RawType /// is the same, and if the Count is the same. /// /// The other object to compare against. - /// A boolean if both objects are equal or not. + /// if both objects are equal, otherwise . public override bool Equals(DataViewType other) { if (other == this) @@ -81,12 +81,12 @@ public override bool Equals(DataViewType other) } /// - /// Determine if a KeyType instance is equal to another KeyType instance. - /// Checks if any object is the type of KeyType, if the RawType + /// Determine if a instance is equal to another instance. + /// Checks if any object is the type of , if the RawType /// is the same, and if the Count is the same. /// /// The other object to compare against. - /// A boolean if both objects are equal or not. + /// if both objects are equal, otherwise . public override bool Equals(object other) { return other is DataViewType tmp && Equals(tmp); @@ -102,7 +102,7 @@ public override int GetHashCode() } /// - /// The string representation of the KeyType. + /// The string representation of the . /// /// A formatted string. public override string ToString() From 657caddcc8630ce2ece8c7f33d10a9c52c7344d6 Mon Sep 17 00:00:00 2001 From: J W Date: Sat, 9 Mar 2019 06:55:56 -0500 Subject: [PATCH 4/4] Update XML docs for PR feedback --- src/Microsoft.ML.Core/Data/KeyType.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.ML.Core/Data/KeyType.cs b/src/Microsoft.ML.Core/Data/KeyType.cs index 89e060e026..627f50c323 100644 --- a/src/Microsoft.ML.Core/Data/KeyType.cs +++ b/src/Microsoft.ML.Core/Data/KeyType.cs @@ -15,10 +15,10 @@ namespace Microsoft.ML.Data /// class numbers, etc. For example, in multi-class classification, the label is typically /// a class number which is naturally a KeyType. /// - /// KeyTypes have a cardinality (i.e., Count) that is strictly positive. + /// KeyTypes have a cardinality (i.e., ) that is strictly positive. /// /// Note that the underlying representation value does not necessarily match the logical value. - /// For example, if a KeyType has range 0-5000, then it has a Count of 5001, but + /// For example, if a KeyType has range 0-5000, then it has a of 5001, but /// the representational values are 1-5001. The representation value zero is reserved /// to mean a missing value (similar to NaN). /// @@ -52,17 +52,17 @@ public static bool IsValidDataType(Type type) /// /// is the cardinality of the . Note that such a key type can be converted to a - /// bit vector representation by mapping to a vector of length Count, with "id" mapped to a + /// bit vector representation by mapping to a vector of length , with "id" mapped to a /// vector with 1 in slot (id - 1) and 0 in all other slots. This is the standard "indicator" /// representation. Note that an id of 0 is used to represent the notion "none", which is - /// typically mapped, by for example, one-hot encoding, to a vector of all zeros (of length Count). + /// typically mapped, by for example, one-hot encoding, to a vector of all zeros (of length ). /// public ulong Count { get; } /// /// Determine if this object is equal to another instance. - /// Checks if the other item is the type of , if the RawType - /// is the same, and if the Count is the same. + /// Checks if the other item is the type of , if the + /// is the same, and if the is the same. /// /// The other object to compare against. /// if both objects are equal, otherwise . @@ -82,8 +82,8 @@ public override bool Equals(DataViewType other) /// /// Determine if a instance is equal to another instance. - /// Checks if any object is the type of , if the RawType - /// is the same, and if the Count is the same. + /// Checks if any object is the type of , if the + /// is the same, and if the is the same. /// /// The other object to compare against. /// if both objects are equal, otherwise .