Machine learning enables us to accurately analyse large amounts of data to solve complex problems and is commonly used for image recognition, natural language processing and sentiment analysis. When applied to applications, machine learning delivers extra functionality and facilitates data-driven decisions. However, integrating machine learning techniques into the appropriate technologies can be complex at best. Python is the most common language for machine learning applications, but developers in the .NET environment still have options.
.NET has its own machine learning library, ML.NET, that can solve the issue. What’s more, Microsoft has just unveiled a preview of its ML.NET Text Classification API. The API intends to make it easier for developers to train custom text classification models using the ML.NET framework. With machine learning fastly becoming one of the most popular technologies in the world, the new API is an important step toward enabling natural language processing models in .NET.
What Are the Most Common Machine Learning Applications?
As we’ve touched on, machine learning is used to solve complex problems and build intelligent solutions. The concept comes from the structure and function of the human brain itself but instead uses artificial neural networks to analyse data and make predictions. The technique has found applications in almost every industry, with some of the most popular uses including:
- Virtual assistants – these cloud-based applications are able to understand natural language voice commands and complete tasks. Every time they receive a command, they provide a better experience based on deep learning algorithms.
- Chatbots – these AI applications use text or text-to-speech to solve customer problems in seconds. They are used in many customer interactions and enable automated responses to be delivered to user inputs.
- Computer-aided detection – within the healthcare sector, deep learning is used for disease detection and diagnosis. The technology is widely used for medical research, drug discovery and diagnosis through the process of medical imaging.
- Personalised recommendations – companies use machine learning to give relevant recommendations to enhance the customer experience. The recommendations are based on a user’s browsing history, interests and behaviour and aim to help them make product and service choices more easily.
- Fraud detection – deep learning and neural networks can create classifiers able to detect fake news and messages and remove them before they are received by the user. The technology can also warn of possible privacy breaches.
- Image captioning – computer vision is used to understand an image’s content and a language model is then used to turn that understanding into a textual description.
What is ML.NET?
ML.NET is Microsoft’s open-source, cross-platform machine learning framework created for .NET developers. It enables the integration of custom machine learning models into .NET apps without the requirement for machine learning experience. The alternative is pre-built AI, where pre-designed general AI services are used from the cloud. While this works for many scenarios, it doesn’t always fit specific business needs.
ML.NET empowers developers to train, build and ship custom machine learning models using C# for a variety of scenarios. It is very flexible and adaptable as developers can train their own ML models and it can be run anywhere. With ML.NET integrating machine learning into .NET applications is easier than ever as it’s:
- Built for .NET developers – there’s no need to leave the .NET ecosystem and developers can reuse all their existing knowledge, skills, code and libraries to easily integrate machine learning into web, mobile, desktop and IoT apps.
- Automated with AutoML – the cutting-edge technology automates the process of building best-performing models. The model builder makes it incredibly easy to build custom ML models.
- Extended with TensorFlow – as an extensible platform, developers are able to incorporate other popular Ml frameworks such as TensorFlow. In doing this, they have access to more scenarios.
- Trusted at scale – ML.NET delivers high performance, speed and accuracy and is used in trusted Microsoft products such as Power BI, Outlook and Bing.
Of course, Microsoft never rests on its laurels and is continually working on improving the ML.NET framework and tooling. Part of the company’s deep-learning plan includes the introduction of scenario-focused APIs, one of which being the Text Classification API, which will make it easier for developers to train custom text classification models using the latest state-of-the-art deep learning techniques.
What is Text Classification
As the name suggests, text classification is the process of applying labels or categories to text. It can be used to detect spam, analyse sentiment or apply labels. Text classification deals specifically with raw text, which poses challenges surrounding context and semantics. Encoding meaning and context can be difficult, which is why deep learning models have come to the forefront as a promising technique to solve these natural language problems.
How Does the ML.NET Text Classification API Work?
On June 14th, Microsoft introduced its ML.NET Text Classification API. The API uses state-of-the-art deep learning techniques to enable developers to integrate custom machine learning models into .NET apps.
The new ML.NET Text Classification API incorporates many of the deep learning techniques to solve text classification problems. The API is powered by TorchSharp, a .NET library that contains the building blocks for training neural networks from scratch in .NET. As TorchSharp components are low-level and building neural networks is complex, some of the complexity has been abstracted. To do that, Microsoft has taken a TorchSharp implementation of NAS-BERT and added it to ML.NET. By using a pre-trained version of this model, the API can then be fine-tuned by using custom user data.
What’s Next for ML.NET?
While the ML.NET Text Classification API is an important step towards enabling natural language scenarios in ML.NET, there are still several limitations. One of these includes not being able to use the Evaluate method to calculate evaluation metrics. As always, Microsoft has taken user feedback on board and plans to make improvements to the Text Classification API and interact with other scenario-based APIs.