How Machine Learning in B2B eCommerce Works

Virto Commerce
6 min readMar 24, 2022

Machine Learning in ecommerce is often presented as some kind of AI magic that will do any analytical work you can imagine. The truth is, even using AI tools with a visual interface such as Microsoft Azure Machine Learning Studio, requires a professional Data Scientist to work with this service.

Here I want to explain to you a bit — the subject area of AI requires a deep knowledge of mathematical models and the skills to evaluate the completeness of data sets. Although you work with a visual interface in Azure Machine Learning Studio, this does not mean just anybody can build AI models on the screen like playing the puzzle game, Tetris .

Another important note about using Microsoft Azure Machine Learning Studio is that it requires very powerful computing resources to run the data scoring model. Your budget should allocate several thousand dollars for even a single AI task to calculate. And this is going on the assumption that the Data Scientist correctly selects the model and data set and does not have to run a recalculation of the model again. Also factor in that the AI model will require regular updates with new data, so the cost of server hardware rent will be ongoing.

The Process of Building an AI Model in eCommerce
Let’s look at calculating the optimal promotional discount as a fairly common task in ecommerce. The goal is to attract the maximum number of customers to place orders offering the lowest possible promo discount. In other words, you want to create an AI model that will tell you the optimal margin vs. sales volume ratio. This task is especially relevant for medium-sized companies and enterprises, where even fractions of a percent in a margin result in significant fluctuations in total revenue.

So, assume a business sets such a task and delegates it to a Data Scientist, who must understand what the business goal is required to achieve and transform this task into a mathematical entity. At this initial stage, the Data Scientist must understand what data the company has and make an assessment as to whether there are enough data sets to start building and training an AI model.

It may turn out that there are not enough data sets and, therefore, the task is currently impossible to do. This stage of assessing the completeness of the data sets shows the level of professionalism of the Data Scientist.

A very important point: at this stage, the Data Scientist must make a decision. In general, for the business task that has been set, is it solvable or not? Can we solve the task with the data set we have on hand? If your data is completely absent or not complete, then, in fact, the Data Scientist is powerless. In that case, it is necessary to explain to business management that, at the moment, it is impossible to solve the problem with the data that exists, or the scatter of solving the problem will be so large that the AI model will be useless.

Most often, the company does not have well-structured data, and, therefore, the Data Scientist will need to collect and evaluate what is available. It will be necessary to conduct a study of this data, for example, to collect statistics of purchases based on promotions that took place previously. Historical data is important — to analyze how prior promotions affected sales volume in the past — and, accordingly, extrapolate this data and use it to train the AI model.

This is also one of the very big parts of a Data Scientist’s job — to properly prepare the data. Well, consider we return to our forecasting, then have to check the data for repeatability. The data may be distorted due to the unique conditions of previous promotional campaigns. For example, was the day a holiday, or a weekend? Maybe there was a seasonal temperature change from winter to summer, which can also affect sales, and so on.

Each sales data property that can affect the results of the AI model is called a feature. In a data set, a feature is a column in an array, which represents a measurable piece of data that can be used for analysis, for example: Customer_Name, Customer’s_company_name, Buyer_Position, Buyer_Age, and so on. Depending on the nature of the task, the features you include in a data set can vary widely.

This process of creating models demands a high computational resource. If you have only one server with a dozen cores, then it could take a week to calculate just one complex model. More often than not, a Data Scientist has to perform calculations for dozens of AI models before getting a good model for a company’s specific data.

Accordingly, here it is very important for the Data Scientist to have a budget that allows the rental of high-end cloud servers for parallelizing the model calculation, so that a dozen or more models can be calculated in parallel at one time. Accordingly, to get it in a reasonable amount of time, assess these models to see which one works best.

Let’s talk about the convenience and cost of cloud computing. In Azure, a scalable cluster is deployed for you exactly at the moment it’s needed; it’s only at this moment you start paying for Azure cloud servers. Further, when your models are all calculated, you stop paying for cloud servers. It is very convenient, logical, and cost-efficient to use computing resources in this way.

So, after models are built, we deploy the models and check their forecasting ability. Accordingly, when we have determined which AI model works best, we need to present this model to business management, so they can use the AI model for promo sales forecasting.

For example, suppose you have a high seasonal sale in two weeks. The model should forecast what percentage of discount to offer during the promo sales.

The Retraining Cycle for the AI Model in eCommerce
After the AI model has been selected, tested, and deployed, the process does not end there. The model requires constant training on new data sets, and this cycle is continually repeated. In other words, we built the model once, and now we must set up a pipeline for its training.

Moreover, it may turn out that, with the new data from the last promotional campaign, the current model is doing worse. Again, we load a new piece of data, create features (columns in data array), calculate models, test them, select the best, and a new model goes to deploy.

This process is usually cyclical and occurs depending on the tasks either once every two weeks or once a month. Some tasks are resolved every quarter or twice a year. The cycle duration depends on the success of the model and the operation of the business itself.

Here the most important point is that the AI training process in production becomes cyclical. One key is being able to manage this process from beginning to end. Also, impose some kind of metrics on this process to be sure you submitted the correct data to the input, your models were trained correctly, and the assessment chose the best model to be deployed.

Suppose something went wrong and your AI model began to work worse in production. In that instance, you can always deploy an older version, the previous one.

Summary
Consider Azure Machine Learning Studio as a tool that covers all stages of AI model creation and implementation. It is important for Data Scientists to know this tool is specifically intended for the industrial application of AI in ecommerce and across industries.

Data Scientists must use the metrics and monitoring block in Azure Machine Learning Studio to be sure the model works perfectly in production in every way.

Want to read more about AI in ecommerce?

Author: Sergey Berezin
Marketing writer

--

--

Virto Commerce

Digital commerce software | the most scalable & customizable B2B open source .NET ecommerce platform