Skip to content

[Tiny & Simple Change] Example classes should be static #2548

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
Feb 14, 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
4 changes: 2 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/Calibrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace Microsoft.ML.Samples.Dynamic
/// <summary>
/// This example first trains a StochasticDualCoordinateAscentBinary Classifier and then convert its output to probability via training a calibrator.
/// </summary>
public class CalibratorExample
public static class Calibrator
{
public static void Calibration()
public static void Example()
{
// Downloading the dataset from github.com/dotnet/machinelearning.
// This will create a sentiment.tsv file in the filesystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public static class BootstrapSample
public static class Bootstrap
{
public static void Example()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class FastTreeRegressionExample
public static class FastTreeRegression
{
public static void FastTreeRegression()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class FeatureContributionCalculationTransform
public static class FeatureContributionCalculationTransform
{
public static void Example()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class FeatureSelectionTransformExample
public static class FeatureSelectionTransform
{
public static void FeatureSelectionTransform()
public static void Example()
{
// Downloading a classification dataset from github.com/dotnet/machinelearning.
// It will be stored in the same path as the executable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using Microsoft.ML.Data;
namespace Microsoft.ML.Samples.Dynamic
{
public class FFM_BinaryClassificationExample
public static class FFMBinaryClassification
{
public static void FFM_BinaryClassification()
public static void Example()
{
// Downloading the dataset from github.com/dotnet/machinelearning.
// This will create a sentiment.tsv file in the filesystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class GeneralizedAdditiveModels_RegressionExample
public static class GeneralizedAdditiveModelsRegression
{
public static void RunExample()
public static void Example()
{
// Create a new context for ML.NET operations. It can be used for exception tracking and logging,
// as a catalog of available operations and as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public partial class TransformSamples
public static partial class TransformSamples
{
class ChangePointPrediction
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public partial class TransformSamples
public static partial class TransformSamples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TransformSamples [](start = 32, length = 16)

All timeseries example slightly different from our current samples.
They share same class and introduce data classes inside it, instead of using sample utils.
But I'm not sure they transformation to how we see samples should be done in your PR.

{
class IidSpikeData
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class ConvertToGrayscaleExample
public static class ConvertToGrayscale
{
// Sample that loads images from the file system, and converts them to grayscale.
public static void ConvertToGrayscale()
public static void Example()
{
var mlContext = new MLContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class ExtractPixelsExample
public static class ExtractPixels
{
// Sample that loads the images from the file system, resizes them (ExtractPixels requires a resizing operation), and extracts the
// values of the pixels as a vector.
public static void ExtractPixels()
public static void Example()
{
var mlContext = new MLContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class LoadImageExample
public static class LoadImage
{
// Loads the images of the imagesFolder into an IDataView.
public static void LoadImage()
public static void Example()
{
var mlContext = new MLContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class ResizeImageExample
public static class ResizeImage
{
// Example on how to load the images from the file system, and resize them.
public static void ResizeImage()
public static void Example()
{
var mlContext = new MLContext();

Expand Down
4 changes: 2 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/KMeans.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class KMeans_example
public class KMeans
{
public static void KMeans()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
using System.Collections.Generic;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.Conversions;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
{
public class KeyToValueValueToKeyExample
public class KeyToValueValueToKey
{
public static void KeyToValueValueToKey()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/LdaTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class LdaTransformExample
public static class LdaTransform
{
public static void LdaTransform()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class LogisticRegressionExample
public static class LogisticRegressionExample
{
public static void LogisticRegression()
public static void Example()
{
var ml = new MLContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public partial class NgramTransformSamples
public static partial class TransformSamples
{
public static void NgramTransform()
{
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/Normalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class NormalizerExample
public static class NormalizerTransform
{
public static void Normalizer()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/OnnxTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

namespace Microsoft.ML.Samples.Dynamic
{
class OnnxTransformExample
public static class OnnxTransformExample
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) you've dropped the Example suffix in other places, but not here.

{
/// <summary>
/// Example use of OnnxEstimator in an ML.NET pipeline
/// </summary>
public static void OnnxTransformSample()
public static void Example()
{
// Download the squeeznet image model from ONNX model zoo, version 1.2
// https://github.com/onnx/models/tree/master/squeezenet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;
using System.Linq;
using Microsoft.Data.DataView;
using Microsoft.ML.Data;
using Microsoft.ML.Trainers;
using Microsoft.ML.SamplesUtils;
using Microsoft.ML.Trainers.HalLearners;

namespace Microsoft.ML.Samples.Dynamic.PermutationFeatureImportance
{
public class PfiHelper
public static class PfiHelper
{
public static IDataView GetHousingRegressionIDataView(MLContext mlContext, out string labelName, out string[] featureNames, bool binaryPrediction = false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace Microsoft.ML.Samples.Dynamic.PermutationFeatureImportance
{
public class PfiRegressionExample
public static class PfiRegression
{
public static void RunExample()
public static void Example()
{
// Create a new context for ML.NET operations. It can be used for exception tracking and logging,
// as a catalog of available operations and as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Microsoft.ML.Samples.Dynamic.PermutationFeatureImportance
{
public class PfiBinaryClassificationExample
public static class PfiBinaryClassification
{
public static void RunExample()
public static void Example()
{
// Create a new context for ML.NET operations. It can be used for exception tracking and logging,
// as a catalog of available operations and as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class ProjectionTransformsExample
public static class ProjectionTransforms
{
public static void ProjectionTransforms()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/SDCARegression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class SDCARegressionExample
public static class SDCARegression
{
public static void SDCARegression()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public partial class TransformSamples
public static partial class TransformSamples
{
class SsaChangePointData
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public partial class TransformSamples
public static partial class TransformSamples
{
class SsaSpikeData
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class StopWordRemoverTransformExample
public static class StopWordRemoverTransform
{
public static void StopWordRemoverTransform()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Microsoft.ML.Samples.Dynamic.TensorFlow
{
class ImageClassification
public static class ImageClassification
{
/// <summary>
/// Example use of the TensorFlow image model in a ML.NET pipeline.
/// </summary>
public static void ScoringWithImageClassificationModelSample()
public static void Example()
{
// Download the ResNet 101 model from the location below.
// https://storage.googleapis.com/download.tensorflow.org/models/tflite_11_05_08/resnet_v2_101.tgz
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.TensorFlow;

namespace Microsoft.ML.Samples.Dynamic.TensorFlow
{
class TextClassification
public static class TextClassification
{
public const int MaxSentenceLenth = 600;
/// <summary>
/// Example use of the TensorFlow sentiment classification model.
/// </summary>
public static void ScoringWithTextClassificationModelSample()
public static void Example()
{
string modelLocation = SamplesUtils.DatasetUtils.DownloadTensorFlowSentimentModel();

Expand Down
4 changes: 2 additions & 2 deletions docs/samples/Microsoft.ML.Samples/Dynamic/TextTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class TextTransformExample
public static class TextTransform
{
public static void TextTransform()
public static void Example()
{
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,
// as well as the source of randomness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class SDCALogisticRegression
public static class SDCALogisticRegression
{
public static void Example()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.ML.Samples.Dynamic
{
public class SDCASupportVectorMachine
public static class SDCASupportVectorMachine
{
public static void Example()
{
Expand Down
Loading