Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiding of ColumnOptions #2959

Merged
merged 9 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions src/Microsoft.ML.Data/Transforms/ConversionsExtensionsCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static HashingEstimator Hash(this TransformsCatalog.ConversionTransforms
/// </summary>
/// <param name="catalog">The conversion transform's catalog.</param>
/// <param name="columns">Description of dataset columns and how to process them.</param>
public static HashingEstimator Hash(this TransformsCatalog.ConversionTransforms catalog, params HashingEstimator.ColumnOptions[] columns)
[BestFriend]
internal static HashingEstimator Hash(this TransformsCatalog.ConversionTransforms catalog, params HashingEstimator.ColumnOptions[] columns)
=> new HashingEstimator(CatalogUtils.GetEnvironment(catalog), columns);

/// <summary>
Expand All @@ -62,7 +63,8 @@ public static TypeConvertingEstimator ConvertType(this TransformsCatalog.Convers
/// </summary>
/// <param name="catalog">The conversion transform's catalog.</param>
/// <param name="columns">Description of dataset columns and how to process them.</param>
public static TypeConvertingEstimator ConvertType(this TransformsCatalog.ConversionTransforms catalog, params TypeConvertingEstimator.ColumnOptions[] columns)
[BestFriend]
internal static TypeConvertingEstimator ConvertType(this TransformsCatalog.ConversionTransforms catalog, params TypeConvertingEstimator.ColumnOptions[] columns)
=> new TypeConvertingEstimator(CatalogUtils.GetEnvironment(catalog), columns);

/// <summary>
Expand Down Expand Up @@ -92,15 +94,17 @@ public static KeyToValueMappingEstimator MapKeyToValue(this TransformsCatalog.Co
/// [!code-csharp[KeyToValueMappingEstimator](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ValueMappingStringToKeyType.cs)]
/// ]]></format>
/// </example>
public static KeyToValueMappingEstimator MapKeyToValue(this TransformsCatalog.ConversionTransforms catalog, params ColumnOptions[] columns)
[BestFriend]
internal static KeyToValueMappingEstimator MapKeyToValue(this TransformsCatalog.ConversionTransforms catalog, params ColumnOptions[] columns)
=> new KeyToValueMappingEstimator(CatalogUtils.GetEnvironment(catalog), ColumnOptions.ConvertToValueTuples(columns));

/// <summary>
/// Maps key types or key values into a floating point vector.
/// </summary>
/// <param name="catalog">The conversion transform's catalog.</param>
/// <param name="columns">The input column to map back to vectors.</param>
public static KeyToVectorMappingEstimator MapKeyToVector(this TransformsCatalog.ConversionTransforms catalog,
[BestFriend]
internal static KeyToVectorMappingEstimator MapKeyToVector(this TransformsCatalog.ConversionTransforms catalog,
params KeyToVectorMappingEstimator.ColumnOptions[] columns)
=> new KeyToVectorMappingEstimator(CatalogUtils.GetEnvironment(catalog), columns);

Expand Down Expand Up @@ -154,7 +158,8 @@ public static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.Co
/// ]]>
/// </format>
/// </example>
public static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.ConversionTransforms catalog,
[BestFriend]
internal static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.ConversionTransforms catalog,
ValueToKeyMappingEstimator.ColumnOptions[] columns, IDataView keyData = null)
=> new ValueToKeyMappingEstimator(CatalogUtils.GetEnvironment(catalog), columns, keyData);

Expand All @@ -178,7 +183,8 @@ public static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.Co
/// [!code-csharp[ValueMappingEstimator](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ValueMappingStringToArray.cs)]
/// ]]></format>
/// </example>
public static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
[BestFriend]
internal static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
this TransformsCatalog.ConversionTransforms catalog,
IEnumerable<TInputType> keys,
IEnumerable<TOutputType> values,
Expand All @@ -203,7 +209,8 @@ public static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType
/// [!code-csharp[ValueMappingEstimator](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ValueMappingStringToKeyType.cs)]
/// ]]></format>
/// </example>
public static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
[BestFriend]
internal static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
this TransformsCatalog.ConversionTransforms catalog,
IEnumerable<TInputType> keys,
IEnumerable<TOutputType> values,
Expand Down Expand Up @@ -232,7 +239,8 @@ public static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType
/// [!code-csharp[ValueMappingEstimator](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ValueMappingStringToArray.cs)]
/// ]]></format>
/// </example>
public static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
[BestFriend]
internal static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
this TransformsCatalog.ConversionTransforms catalog,
IEnumerable<TInputType> keys,
IEnumerable<TOutputType[]> values,
Expand All @@ -258,7 +266,8 @@ public static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType
/// [!code-csharp[ValueMappingEstimator](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ValueMappingStringToArray.cs)]
/// ]]></format>
/// </example>
public static ValueMappingEstimator MapValue(
[BestFriend]
internal static ValueMappingEstimator MapValue(
this TransformsCatalog.ConversionTransforms catalog,
IDataView lookupMap, string keyColumnName, string valueColumnName, params ColumnOptions[] columns)
=> new ValueMappingEstimator(CatalogUtils.GetEnvironment(catalog), lookupMap, keyColumnName, valueColumnName,
Expand Down
6 changes: 4 additions & 2 deletions src/Microsoft.ML.Data/Transforms/ExtensionsCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace Microsoft.ML
/// <summary>
/// Specifies input and output column names for a transformation.
/// </summary>
public sealed class ColumnOptions
[BestFriend]
internal sealed class ColumnOptions
artidoro marked this conversation as resolved.
Show resolved Hide resolved
{
private readonly string _outputColumnName;
private readonly string _inputColumnName;
Expand Down Expand Up @@ -77,7 +78,8 @@ public static ColumnCopyingEstimator CopyColumns(this TransformsCatalog catalog,
/// ]]>
/// </format>
/// </example>
public static ColumnCopyingEstimator CopyColumns(this TransformsCatalog catalog, params ColumnOptions[] columns)
[BestFriend]
internal static ColumnCopyingEstimator CopyColumns(this TransformsCatalog catalog, params ColumnOptions[] columns)
=> new ColumnCopyingEstimator(CatalogUtils.GetEnvironment(catalog), ColumnOptions.ConvertToValueTuples(columns));

/// <summary>
Expand Down
15 changes: 10 additions & 5 deletions src/Microsoft.ML.ImageAnalytics/ExtensionsCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public static class ImageEstimatorsCatalog
/// [!code-csharp[ConvertToGrayscale](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/ImageAnalytics/ConvertToGrayscale.cs)]
/// ]]></format>
/// </example>
public static ImageGrayscalingEstimator ConvertToGrayscale(this TransformsCatalog catalog, params ColumnOptions[] columns)
[BestFriend]
internal static ImageGrayscalingEstimator ConvertToGrayscale(this TransformsCatalog catalog, params ColumnOptions[] columns)
=> new ImageGrayscalingEstimator(CatalogUtils.GetEnvironment(catalog), ColumnOptions.ConvertToValueTuples(columns));

/// <summary>
Expand All @@ -41,7 +42,8 @@ public static ImageGrayscalingEstimator ConvertToGrayscale(this TransformsCatalo
/// [!code-csharp[LoadImages](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/ImageAnalytics/LoadImages.cs)]
/// ]]></format>
/// </example>
public static ImageLoadingEstimator LoadImages(this TransformsCatalog catalog, string imageFolder, params ColumnOptions[] columns)
[BestFriend]
internal static ImageLoadingEstimator LoadImages(this TransformsCatalog catalog, string imageFolder, params ColumnOptions[] columns)
=> new ImageLoadingEstimator(CatalogUtils.GetEnvironment(catalog), imageFolder, ColumnOptions.ConvertToValueTuples(columns));

/// <include file='doc.xml' path='doc/members/member[@name="ImagePixelExtractingEstimator"]/*' />
Expand Down Expand Up @@ -75,7 +77,8 @@ public static ImagePixelExtractingEstimator ExtractPixels(this TransformsCatalog
/// <include file='doc.xml' path='doc/members/member[@name="ImagePixelExtractingEstimator"]/*' />
/// <param name="catalog">The transform's catalog.</param>
/// <param name="columnOptions">The <see cref="ImagePixelExtractingEstimator.ColumnOptions"/> describing how the transform handles each image pixel extraction output input column pair.</param>
public static ImagePixelExtractingEstimator ExtractPixels(this TransformsCatalog catalog, params ImagePixelExtractingEstimator.ColumnOptions[] columnOptions)
[BestFriend]
internal static ImagePixelExtractingEstimator ExtractPixels(this TransformsCatalog catalog, params ImagePixelExtractingEstimator.ColumnOptions[] columnOptions)
=> new ImagePixelExtractingEstimator(CatalogUtils.GetEnvironment(catalog), columnOptions);

/// <summary>
Expand Down Expand Up @@ -133,15 +136,17 @@ public static ImageResizingEstimator ResizeImages(this TransformsCatalog catalog
/// [!code-csharp[ResizeImages](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/ImageAnalytics/ResizeImages.cs)]
/// ]]></format>
/// </example>
public static ImageResizingEstimator ResizeImages(this TransformsCatalog catalog, params ImageResizingEstimator.ColumnOptions[] columnOptions)
[BestFriend]
internal static ImageResizingEstimator ResizeImages(this TransformsCatalog catalog, params ImageResizingEstimator.ColumnOptions[] columnOptions)
=> new ImageResizingEstimator(CatalogUtils.GetEnvironment(catalog), columnOptions);

/// <summary>
/// Converts vectors of pixels into <see cref="ImageType"/> representation.
/// </summary>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="columnOptions">The <see cref="VectorToImageConvertingEstimator.ColumnOptions"/> describing how the transform handles each vector to image conversion column pair.</param>
public static VectorToImageConvertingEstimator ConvertToImage(this TransformsCatalog catalog, params VectorToImageConvertingEstimator.ColumnOptions[] columnOptions)
[BestFriend]
internal static VectorToImageConvertingEstimator ConvertToImage(this TransformsCatalog catalog, params VectorToImageConvertingEstimator.ColumnOptions[] columnOptions)
=> new VectorToImageConvertingEstimator(CatalogUtils.GetEnvironment(catalog), columnOptions);

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.ML.Mkl.Components/MklComponentsCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ public static VectorWhiteningEstimator VectorWhiten(this TransformsCatalog catal
/// ]]>
/// </format>
/// </example>
public static VectorWhiteningEstimator VectorWhiten(this TransformsCatalog catalog, params VectorWhiteningEstimator.ColumnOptions[] columns)
[BestFriend]
internal static VectorWhiteningEstimator VectorWhiten(this TransformsCatalog catalog, params VectorWhiteningEstimator.ColumnOptions[] columns)
=> new VectorWhiteningEstimator(CatalogUtils.GetEnvironment(catalog), columns);

}
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.ML.PCA/PCACatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public static PrincipalComponentAnalyzer ProjectToPrincipalComponents(this Trans
/// <summary>Initializes a new instance of <see cref="PrincipalComponentAnalyzer"/>.</summary>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="columns">Input columns to apply PrincipalComponentAnalysis on.</param>
public static PrincipalComponentAnalyzer ProjectToPrincipalComponents(this TransformsCatalog catalog, params PrincipalComponentAnalyzer.ColumnOptions[] columns)
[BestFriend]
internal static PrincipalComponentAnalyzer ProjectToPrincipalComponents(this TransformsCatalog catalog, params PrincipalComponentAnalyzer.ColumnOptions[] columns)
=> new PrincipalComponentAnalyzer(CatalogUtils.GetEnvironment(catalog), columns);

/// <summary>
Expand Down
9 changes: 6 additions & 3 deletions src/Microsoft.ML.Transforms/CategoricalCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public static OneHotEncodingEstimator OneHotEncoding(this TransformsCatalog.Cate
/// </summary>
/// <param name="catalog">The transform catalog</param>
/// <param name="columns">The column settings.</param>
public static OneHotEncodingEstimator OneHotEncoding(this TransformsCatalog.CategoricalTransforms catalog,
[BestFriend]
internal static OneHotEncodingEstimator OneHotEncoding(this TransformsCatalog.CategoricalTransforms catalog,
params OneHotEncodingEstimator.ColumnOptions[] columns)
=> new OneHotEncodingEstimator(CatalogUtils.GetEnvironment(catalog), columns);

Expand All @@ -42,7 +43,8 @@ public static OneHotEncodingEstimator OneHotEncoding(this TransformsCatalog.Cate
/// <param name="columns">The column settings.</param>
/// <param name="keyData">Specifies an ordering for the encoding. If specified, this should be a single column data view,
/// and the key-values will be taken from that column. If unspecified, the ordering will be determined from the input data upon fitting.</param>
public static OneHotEncodingEstimator OneHotEncoding(this TransformsCatalog.CategoricalTransforms catalog,
[BestFriend]
internal static OneHotEncodingEstimator OneHotEncoding(this TransformsCatalog.CategoricalTransforms catalog,
OneHotEncodingEstimator.ColumnOptions[] columns,
IDataView keyData = null)
=> new OneHotEncodingEstimator(CatalogUtils.GetEnvironment(catalog), columns, keyData);
Expand Down Expand Up @@ -72,7 +74,8 @@ public static OneHotHashEncodingEstimator OneHotHashEncoding(this TransformsCata
/// </summary>
/// <param name="catalog">The transform catalog</param>
/// <param name="columns">The column settings.</param>
public static OneHotHashEncodingEstimator OneHotHashEncoding(this TransformsCatalog.CategoricalTransforms catalog,
[BestFriend]
internal static OneHotHashEncodingEstimator OneHotHashEncoding(this TransformsCatalog.CategoricalTransforms catalog,
params OneHotHashEncodingEstimator.ColumnOptions[] columns)
=> new OneHotHashEncodingEstimator(CatalogUtils.GetEnvironment(catalog), columns);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.ML.Transforms/ConversionsCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public static class ConversionsCatalog
/// </summary>
/// <param name="catalog">The categorical transform's catalog.</param>
/// <param name="columns">Specifies the output and input columns on which the transformation should be applied.</param>
public static KeyToBinaryVectorMappingEstimator MapKeyToBinaryVector(this TransformsCatalog.ConversionTransforms catalog,
[BestFriend]
internal static KeyToBinaryVectorMappingEstimator MapKeyToBinaryVector(this TransformsCatalog.ConversionTransforms catalog,
params ColumnOptions[] columns)
=> new KeyToBinaryVectorMappingEstimator(CatalogUtils.GetEnvironment(catalog), ColumnOptions.ConvertToValueTuples(columns));

Expand Down
6 changes: 4 additions & 2 deletions src/Microsoft.ML.Transforms/ExtensionsCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public static class ExtensionsCatalog
/// </summary>
/// <param name="catalog">The transform extensions' catalog.</param>
/// <param name="columns">The names of the input columns of the transformation and the corresponding names for the output columns.</param>
public static MissingValueIndicatorEstimator IndicateMissingValues(this TransformsCatalog catalog,
[BestFriend]
internal static MissingValueIndicatorEstimator IndicateMissingValues(this TransformsCatalog catalog,
params ColumnOptions[] columns)
=> new MissingValueIndicatorEstimator(CatalogUtils.GetEnvironment(catalog), ColumnOptions.ConvertToValueTuples(columns));

Expand Down Expand Up @@ -58,7 +59,8 @@ public static MissingValueReplacingEstimator ReplaceMissingValues(this Transform
/// </summary>
/// <param name="catalog">The transform extensions' catalog.</param>
/// <param name="columns">The name of the columns to use, and per-column transformation configuraiton.</param>
public static MissingValueReplacingEstimator ReplaceMissingValues(this TransformsCatalog catalog, params MissingValueReplacingEstimator.ColumnOptions[] columns)
[BestFriend]
internal static MissingValueReplacingEstimator ReplaceMissingValues(this TransformsCatalog catalog, params MissingValueReplacingEstimator.ColumnOptions[] columns)
=> new MissingValueReplacingEstimator(CatalogUtils.GetEnvironment(catalog), columns);
}
}
6 changes: 4 additions & 2 deletions src/Microsoft.ML.Transforms/FeatureSelectionCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public static class FeatureSelectionCatalog
/// ]]>
/// </format>
/// </example>
public static MutualInformationFeatureSelectingEstimator SelectFeaturesBasedOnMutualInformation(this TransformsCatalog.FeatureSelectionTransforms catalog,
[BestFriend]
internal static MutualInformationFeatureSelectingEstimator SelectFeaturesBasedOnMutualInformation(this TransformsCatalog.FeatureSelectionTransforms catalog,
string labelColumnName = MutualInfoSelectDefaults.LabelColumn,
int slotsInOutput = MutualInfoSelectDefaults.SlotsInOutput,
int numberOfBins = MutualInfoSelectDefaults.NumBins,
Expand Down Expand Up @@ -64,7 +65,8 @@ public static MutualInformationFeatureSelectingEstimator SelectFeaturesBasedOnMu
/// ]]>
/// </format>
/// </example>
public static CountFeatureSelectingEstimator SelectFeaturesBasedOnCount(this TransformsCatalog.FeatureSelectionTransforms catalog,
[BestFriend]
internal static CountFeatureSelectingEstimator SelectFeaturesBasedOnCount(this TransformsCatalog.FeatureSelectionTransforms catalog,
params CountFeatureSelectingEstimator.ColumnOptions[] columns)
=> new CountFeatureSelectingEstimator(CatalogUtils.GetEnvironment(catalog), columns);

Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.ML.Transforms/KernelCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public static ApproximatedKernelMappingEstimator ApproximatedKernelMap(this Tran
/// </summary>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="columns">The input columns to use for the transformation.</param>
public static ApproximatedKernelMappingEstimator ApproximatedKernelMap(this TransformsCatalog catalog, params ApproximatedKernelMappingEstimator.ColumnOptions[] columns)
[BestFriend]
internal static ApproximatedKernelMappingEstimator ApproximatedKernelMap(this TransformsCatalog catalog, params ApproximatedKernelMappingEstimator.ColumnOptions[] columns)
=> new ApproximatedKernelMappingEstimator(CatalogUtils.GetEnvironment(catalog), columns);
}
}
Loading