Skip to content

Remove Microsoft.ML prefix from namespaces in samples binary. #3267

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

Merged
merged 1 commit into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class BootstrapSample
{
Expand All @@ -12,7 +13,7 @@ public static void Example()
var mlContext = new MLContext();

// Get a small dataset as an IEnumerable and them read it as ML.NET's data type.
IEnumerable<SamplesUtils.DatasetUtils.BinaryLabelFloatFeatureVectorFloatWeightSample> enumerableOfData = SamplesUtils.DatasetUtils.GenerateBinaryLabelFloatFeatureVectorFloatWeightSamples(5);
IEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.BinaryLabelFloatFeatureVectorFloatWeightSample> enumerableOfData = Microsoft.ML.SamplesUtils.DatasetUtils.GenerateBinaryLabelFloatFeatureVectorFloatWeightSamples(5);
var data = mlContext.Data.LoadFromEnumerable(enumerableOfData);

// Look at the original dataset
Expand Down Expand Up @@ -43,7 +44,7 @@ public static void Example()
{
var resample = mlContext.Data.BootstrapSample(data, seed: i);

var enumerable = mlContext.Data.CreateEnumerable<SamplesUtils.DatasetUtils.BinaryLabelFloatFeatureVectorFloatWeightSample>(resample, reuseRowObject: false);
var enumerable = mlContext.Data.CreateEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.BinaryLabelFloatFeatureVectorFloatWeightSample>(resample, reuseRowObject: false);
Console.WriteLine($"Label\tFeatures[0]");
foreach (var row in enumerable)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using Microsoft.ML;
using Microsoft.ML.SamplesUtils;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class Cache
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using static Microsoft.ML.DataOperationsCatalog;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
/// <summary>
/// Sample class showing how to use CrossValidationSplit.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using Microsoft.ML.SamplesUtils;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
/// <summary>
/// Sample class showing how to use ShuffleRows.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
/// <summary>
/// Sample class showing how to use FilterRowsByColumn.
Expand All @@ -15,7 +16,7 @@ public static void Example()
var mlContext = new MLContext();

// Get a small dataset as an IEnumerable.
IEnumerable<SamplesUtils.DatasetUtils.SampleTemperatureData> enumerableOfData = SamplesUtils.DatasetUtils.GetSampleTemperatureData(10);
IEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.SampleTemperatureData> enumerableOfData = Microsoft.ML.SamplesUtils.DatasetUtils.GetSampleTemperatureData(10);
var data = mlContext.Data.LoadFromEnumerable(enumerableOfData);

// Before we apply a filter, examine all the records in the dataset.
Expand All @@ -42,7 +43,7 @@ public static void Example()
var filteredData = mlContext.Data.FilterRowsByColumn(data, columnName: "Temperature", lowerBound: 34, upperBound: 37);

// Look at the filtered data and observe that values outside [34,37) have been dropped.
var enumerable = mlContext.Data.CreateEnumerable<SamplesUtils.DatasetUtils.SampleTemperatureData>(filteredData, reuseRowObject: true);
var enumerable = mlContext.Data.CreateEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.SampleTemperatureData>(filteredData, reuseRowObject: true);
Console.WriteLine($"Date\tTemperature");
foreach (var row in enumerable)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.SamplesUtils;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
using MulticlassClassificationExample = DatasetUtils.MulticlassClassificationExample;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using Microsoft.ML;
using Microsoft.ML.SamplesUtils;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public class FilterRowsByMissingValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using Microsoft.ML;
using Microsoft.ML.SamplesUtils;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
/// <summary>
/// Sample class showing how to use ShuffleRows.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
namespace Microsoft.ML.Samples.Dynamic
using Microsoft.ML;

namespace Samples.Dynamic
{
/// <summary>
/// Sample class showing how to use Skip.
Expand All @@ -13,7 +15,7 @@ public static void Example()
var mlContext = new MLContext();

// Get a small dataset as an IEnumerable.
var enumerableOfData = SamplesUtils.DatasetUtils.GetSampleTemperatureData(10);
var enumerableOfData = Microsoft.ML.SamplesUtils.DatasetUtils.GetSampleTemperatureData(10);
var data = mlContext.Data.LoadFromEnumerable(enumerableOfData);

// Before we apply a filter, examine all the records in the dataset.
Expand All @@ -40,7 +42,7 @@ public static void Example()
var filteredData = mlContext.Data.SkipRows(data, 5);

// Look at the filtered data and observe that the first 5 rows have been dropped
var enumerable = mlContext.Data.CreateEnumerable<SamplesUtils.DatasetUtils.SampleTemperatureData>(filteredData, reuseRowObject: true);
var enumerable = mlContext.Data.CreateEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.SampleTemperatureData>(filteredData, reuseRowObject: true);
Console.WriteLine($"Date\tTemperature");
foreach (var row in enumerable)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
namespace Microsoft.ML.Samples.Dynamic
using Microsoft.ML;

namespace Samples.Dynamic
{
/// <summary>
/// Sample class showing how to use Take.
Expand All @@ -13,7 +15,7 @@ public static void Example()
var mlContext = new MLContext();

// Get a small dataset as an IEnumerable.
var enumerableOfData = SamplesUtils.DatasetUtils.GetSampleTemperatureData(10);
var enumerableOfData = Microsoft.ML.SamplesUtils.DatasetUtils.GetSampleTemperatureData(10);
var data = mlContext.Data.LoadFromEnumerable(enumerableOfData);

// Before we apply a filter, examine all the records in the dataset.
Expand All @@ -40,7 +42,7 @@ public static void Example()
var filteredData = mlContext.Data.TakeRows(data, 5);

// Look at the filtered data and observe that only the first 5 rows are in the resulting dataset.
var enumerable = mlContext.Data.CreateEnumerable<SamplesUtils.DatasetUtils.SampleTemperatureData>(filteredData, reuseRowObject: true);
var enumerable = mlContext.Data.CreateEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.SampleTemperatureData>(filteredData, reuseRowObject: true);
Console.WriteLine($"Date\tTemperature");
foreach (var row in enumerable)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.ML.Data;
using Microsoft.ML;
using static Microsoft.ML.DataOperationsCatalog;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
/// <summary>
/// Sample class showing how to use TrainTestSplit.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.SamplesUtils;
using Microsoft.ML.Trainers;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class FeatureContributionCalculationTransform
{
Expand Down
5 changes: 3 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/NgramExtraction.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using Microsoft.ML.Data;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static partial class TransformSamples
{
Expand All @@ -13,7 +14,7 @@ public static void Example()
var ml = new MLContext();

// Get a small dataset as an IEnumerable and convert to IDataView.
IEnumerable<SamplesUtils.DatasetUtils.SampleSentimentData> data = SamplesUtils.DatasetUtils.GetSentimentData();
IEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.SampleSentimentData> data = Microsoft.ML.SamplesUtils.DatasetUtils.GetSentimentData();
var trainData = ml.Data.LoadFromEnumerable(data);

// Preview of the data.
Expand Down
5 changes: 3 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/Normalizer.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using Microsoft.ML.Data;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class NormalizerTransform
{
Expand All @@ -13,7 +14,7 @@ public static void Example()
var ml = new MLContext();

// Get a small dataset as an IEnumerable and convert it to an IDataView.
IEnumerable<SamplesUtils.DatasetUtils.SampleInfertData> data = SamplesUtils.DatasetUtils.GetInfertData();
IEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.SampleInfertData> data = Microsoft.ML.SamplesUtils.DatasetUtils.GetInfertData();
var trainData = ml.Data.LoadFromEnumerable(data);

// Preview of the data.
Expand Down
3 changes: 2 additions & 1 deletion docs/samples/Microsoft.ML.Samples/Dynamic/OnnxTransform.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.OnnxRuntime;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class OnnxTransformExample
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
using System.Linq;
using Microsoft.ML.Trainers;
using Microsoft.ML.SamplesUtils;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic.PermutationFeatureImportance
namespace Samples.Dynamic.PermutationFeatureImportance
{
public static class PfiHelper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using System.Linq;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic.PermutationFeatureImportance
namespace Samples.Dynamic.PermutationFeatureImportance
{
public static class PfiRegression
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Trainers;

namespace Microsoft.ML.Samples.Dynamic.PermutationFeatureImportance
namespace Samples.Dynamic.PermutationFeatureImportance
{
public static class PfiBinaryClassification
{
Expand Down
25 changes: 14 additions & 11 deletions docs/samples/Microsoft.ML.Samples/Dynamic/ProjectionTransforms.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Data;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ProjectionTransforms
{
Expand All @@ -14,7 +15,7 @@ public static void Example()
var ml = new MLContext();

// Get a small dataset as an IEnumerable and convert it to an IDataView.
IEnumerable<SamplesUtils.DatasetUtils.SampleVectorOfNumbersData> data = SamplesUtils.DatasetUtils.GetVectorOfNumbersData();
IEnumerable<Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData> data = Microsoft.ML.SamplesUtils.DatasetUtils.GetVectorOfNumbersData();
var trainData = ml.Data.LoadFromEnumerable(data);

// Preview of the data.
Expand All @@ -37,13 +38,13 @@ public static void Example()
};

// A pipeline to project Features column into Random fourier space.
var rffPipeline = ml.Transforms.ApproximatedKernelMap(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), rank: 4);
var rffPipeline = ml.Transforms.ApproximatedKernelMap(nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), rank: 4);
// The transformed (projected) data.
var transformedData = rffPipeline.Fit(trainData).Transform(trainData);
// Getting the data of the newly created column, so we can preview it.
var randomFourier = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);
var randomFourier = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);

printHelper(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), randomFourier);
printHelper(nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), randomFourier);

// Features column obtained post-transformation.
//
Expand All @@ -55,13 +56,15 @@ public static void Example()
//0.165 0.117 -0.547 0.014

// A pipeline to project Features column into L-p normalized vector.
var lpNormalizePipeline = ml.Transforms.NormalizeLpNorm(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), norm: Transforms.LpNormNormalizingEstimatorBase.NormFunction.L1);
var lpNormalizePipeline = ml.Transforms.NormalizeLpNorm(nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features),
norm: Microsoft.ML.Transforms.LpNormNormalizingEstimatorBase.NormFunction.L1);

// The transformed (projected) data.
transformedData = lpNormalizePipeline.Fit(trainData).Transform(trainData);
// Getting the data of the newly created column, so we can preview it.
var lpNormalize= transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);
var lpNormalize= transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);

printHelper(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), lpNormalize);
printHelper(nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), lpNormalize);

// Features column obtained post-transformation.
//
Expand All @@ -73,13 +76,13 @@ public static void Example()
// 0.133 0.156 0.178 0.200 0.000 0.022 0.044 0.067 0.089 0.111

// A pipeline to project Features column into L-p normalized vector.
var gcNormalizePipeline = ml.Transforms.NormalizeGlobalContrast(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), ensureZeroMean:false);
var gcNormalizePipeline = ml.Transforms.NormalizeGlobalContrast(nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), ensureZeroMean:false);
// The transformed (projected) data.
transformedData = gcNormalizePipeline.Fit(trainData).Transform(trainData);
// Getting the data of the newly created column, so we can preview it.
var gcNormalize = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);
var gcNormalize = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);

printHelper(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), gcNormalize);
printHelper(nameof(Microsoft.ML.SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), gcNormalize);

// Features column obtained post-transformation.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
using System.Net;
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.Tar;
using Microsoft.ML;
using Microsoft.ML.Data;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ImageClassification
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.IO;
using Microsoft.ML;
using Microsoft.ML.Data;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class TextClassification
{
Expand All @@ -12,7 +13,7 @@ public static class TextClassification
/// </summary>
public static void Example()
{
string modelLocation = SamplesUtils.DatasetUtils.DownloadTensorFlowSentimentModel();
string modelLocation = Microsoft.ML.SamplesUtils.DatasetUtils.DownloadTensorFlowSentimentModel();

var mlContext = new MLContext();
var data = new[] { new IMDBSentiment() {
Expand Down
Loading