예제 #1
0
        /// <summary>
        /// Returns whether a column has the <see cref="Kinds.IsNormalized"/> metadata set to true.
        /// That metadata should be set when the data has undergone transforms that would render it
        /// "normalized."
        /// </summary>
        /// <param name="schema">The schema to query</param>
        /// <param name="col">Which column in the schema to query</param>
        /// <returns>True if and only if the column has the <see cref="Kinds.IsNormalized"/> metadata
        /// set to the scalar value true</returns>
        public static bool IsNormalized(this Schema schema, int col)
        {
            Contracts.CheckValue(schema, nameof(schema));
            var value = default(bool);

            return(schema.TryGetMetadata(BoolType.Instance, Kinds.IsNormalized, col, ref value) && value);
        }
예제 #2
0
        /// <summary>
        /// Whether a column should be added, assuming it's not hidden
        /// (i.e.: this doesn't check for hidden
        /// </summary>
        private bool ShouldAddColumn(Schema schema, int i, uint scoreSet, bool outputNamesAndLabels)
        {
            uint scoreSetId = 0;

            if (schema.TryGetMetadata(MetadataUtils.ScoreColumnSetIdType, MetadataUtils.Kinds.ScoreColumnSetId, i, ref scoreSetId) &&
                scoreSetId == scoreSet)
            {
                return(true);
            }
            if (outputNamesAndLabels)
            {
                switch (schema.GetColumnName(i))
                {
                case "Label":
                case "Name":
                case "Names":
                    return(true);

                default:
                    break;
                }
            }
            if (Args.OutputColumn != null && Array.FindIndex(Args.OutputColumn, schema.GetColumnName(i).Equals) >= 0)
            {
                return(true);
            }
            return(false);
        }