Quantcast
Channel: Category Name
Viewing all articles
Browse latest Browse all 5971

Announcing ML.NET 0.11 – Machine Learning for .NET

$
0
0

alt text

ML.NET is an open-source and cross-platform machine learning framework (Windows, Linux, macOS) for .NET developers. Using ML.NET, developers can leverage their existing tools and skillsets to develop and infuse custom AI into their applications by creating custom machine learning models for common scenarios like Sentiment Analysis, Recommendation, Image Classification and more!.

Today we’re announcing the release of ML.NET 0.11. (ML.NET 0.1 was released at //Build 2018). This release, and all other remaining releases before the v1.0 release, will focus on the overall stability of the framework, continuing to refine the API, fix bugs, reduce the public API surface, and improve documentation and samples.

Updates in v0.11 timeframe

  • Added additional ML components to the MLContext catalog, so it’s easier to find the classes and operations to use. Below you can see the experience based on IntelliSense.

alttext

  • Support for text input in TensorFlowTransformer so you can use TensorFlow models for text analysis (in addition to images). For instance, the following code shows ML.NET scoring a TensorFlow model for a ‘sentiment analysis’ scenario:
public class TensorFlowSentiment
        {
            public string Sentiment_Text;
            [VectorType(600)]
            public int[] Features;
            [VectorType(2)]
            public float[] Prediction;
        }

        [TensorFlowFact]
        public void TensorFlowSentimentClassificationTest()
        {
            var mlContext = new MLContext(seed: 1, conc: 1);
            var data = new[] { new TensorFlowSentiment() { Sentiment_Text = "this film was just brilliant casting location scenery story direction everyone's really suited the part they played and you could just imagine being there robert  is an amazing actor and now the same being director  father came from the same scottish island as myself so i loved the fact there was a real connection with this film the witty remarks throughout the film were great it was just brilliant so much that i bought the film as soon as it was released for  and would recommend it to everyone to watch and the fly fishing was amazing really cried at the end it was so sad and you know what they say if you cry at a film it must have been good and this definitely was also  to the two little boy's that played the  of norman and paul they were just brilliant children are often left out of the  list i think because the stars that play them all grown up are such a big profile for the whole film but these children are amazing and should be praised for what they have done don't you think the whole story was so lovely because it was true and was someone's life after all that was shared with us all" } };
            var dataView = mlContext.Data.ReadFromEnumerable(data);

            var lookupMap = mlContext.Data.ReadFromTextFile(@"sentiment_model/imdb_word_index.csv",
                   columns: new[]
                   {
                        new TextLoader.Column("Words", DataKind.TX, 0),
                        new TextLoader.Column("Ids", DataKind.I4, 1),
                   },
                   separatorChar: ','
               );
               
            var estimator = mlContext.Transforms.Text.TokenizeWords("TokenizedWords", "Sentiment_Text")
                .Append(mlContext.Transforms.Conversion.ValueMap(lookupMap, "Words", "Ids", new[] { ("Features", "TokenizedWords") }));
            var dataPipe = estimator.Fit(dataView)
                .CreatePredictionEngine<TensorFlowSentiment, TensorFlowSentiment>(mlContext);

            string modelLocation = @"sentiment_model";
            var tfEnginePipe = mlContext.Transforms.ScoreTensorFlowModel(modelLocation, new[] { "Prediction/Softmax" }, new[] { "Features" })
                .Append(mlContext.Transforms.CopyColumns(("Prediction", "Prediction/Softmax")))
                .Fit(dataView)
                .CreatePredictionEngine<TensorFlowSentiment, TensorFlowSentiment>(mlContext);

            //Predict the sentiment for the sample data 
            var processedData = dataPipe.Predict(data[0]);
            Array.Resize(ref processedData.Features, 600);
            var prediction = tfEnginePipe.Predict(processedData);
        }

You can see additional code example details in this code

  • ONNX updates: ONNX is an open and iteroperable model format that enables using models trained in one framework (i.e. scikit-learn, TensorFlow, xgboost, etc.) to use in another framework (like ML.NET).
    In ML.NET 0.11 Microsoft.ML.ONNX has been renamed to Microsoft.ML.ONNXConverter and Microsoft.ML.ONNXTransorm has been renamed to Microsoft.ML.ONNXTransformer to make the distinction between ONNX conversion and transformation clearer.

Breaking changes in ML.NET 0.11

For your convenience, if you are moving your code from ML.NET v0.10 to v0.11, you can check out the breaking changes list that impacted our samples.

Explore the community samples and share yours!

As part of the ML.NET Samples repo, we also have a special Community Samples page pointing to multiple samples provided by the community. These samples are not maintained by Microsoft, but they are very interesting and cover additional scenarios not covered by us.

Here’s an screenshot of the current community samples:
https://user-images.githubusercontent.com/1712635/52462663-d2648500-2b28-11e9-80bb-9ce099f8b1e0.png

We encourage you to share your ML.NET demos and samples with the community by simply submitting a brief description and URL pointing to your GitHub repo or blog posts, into this repo issue “Request for your samples!”. We’ll do the rest and publish it at the ML.NET Community Samples page.

Planning to go to production?

alt text

If you are using ML.NET in your app and looking to go into production, you can talk to an engineer on the ML.NET team to:

  • Get help implementing ML.NET successfully in your application.
  • Provide feedback about ML.NET.
  • Demo your app and potentially have it featured on the ML.NET homepage, .NET Blog, or other Microsoft channel.

Fill out this form and leave your contact information at the end if you’d like someone from the ML.NET team to contact you.

Get started!

alt text

If you haven’t already, get started with ML.NET here.

Next, explore further with some other resources:

We appreciate your feedback by filing issues with any suggestions or enhancements in the ML.NET GitHub repo to help us shape ML.NET and make .NET a great platform of choice for Machine Learning.

Thanks and happy coding with ML.NET!

-The ML.NET Team-

This blog was authored by Bri Achtman and Cesar de la Torre, plus additional contributions of the ML.NET team

The post Announcing ML.NET 0.11 – Machine Learning for .NET appeared first on .NET Blog.


Viewing all articles
Browse latest Browse all 5971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>