# Council Post: PID Control and its application in optimising digital marketing campaigns

AI engineers and innovators have expressed concerns that they may lose control over their creations, giving rise to what has come to be called the AI control problem.

Thanks to the recent advancements in technology, particularly in AI and machine learning, many researchers, scientists, AI engineers and innovators have expressed concerns that they may lose control over their creations, giving rise to what has come to be called the AI control problem. The control of both artificial as well as naturally occurring physio-chemical/biological systems is a critical requirement to achieve the desired goals for these systems.

Let’s consider ‘cruise control for a car’ as an example. Here, the actual speed is recorded by the speedometer and is ‘fed-back’ and compared to the speed setting on the cruise control, which causes the engine to accelerate if the speed is too low. Other control systems can be seen in autonomous vehicles, autopilot mode in aeroplanes, anti-lock braking systems in vehicles, etc.

In this article, we will learn about control systems and how these can be used to optimise digital marketing campaigns. But, before that, let us understand a few concepts.

### Control theory

Control theory is an area of applied mathematics that focuses on the behaviour of dynamic systems by studying observability, controllability, stability, and optimality.

Let us now understand these terms one by one:

• Observability: What all variables can we measure for a system?

Observability is nothing but how well the internal states of a system can be inferred based on knowledge of its external outputs. In other words, you should be able to see what is happening inside the system under observation, or the system must be observable.

• Controllability: What all variables can be manipulated to move the system to the desired state?

Controllability is critical in many control problems, including stabilising unstable systems by feedback or optimal control. In other words, you should be able to do whatever you want with the given dynamic system under control input, or the system must be controllable.

• Stability: How well can the system handle small perturbations?

Stability means that the track does not change too much under small perturbations.

• Optimality: How can we keep the system under control with minimum cost?

Optimality is the point where the difference between benefits and costs for a system is maximised.

### Proportional-Integral-Differential (PID) control

One of the core building blocks in control theory is the concept of PID control. To understand how PID control works, let us start with some basic definitions:

• State Variable: Key variable(s) that define the (sub) system that needs to be controlled
• Set Point (SP): Desired value of the state variable(s) that could be static or dynamically changing over time
• Measured value (MV): Actual value of the state variable as measured at a point in time
• Error: Difference between SP & MV
• Control Variable: Key variable(s) that can be manipulated to move the system in the desired direction of minimising the error

Given the above definitions, the PID control model determines how the Error term gets translated into the control variable as follows:

• Proportional (P) Control:  As the name suggests, the control variable is increased/decreased in direct linear proportion to the current level of the error
• Integral (I) Control: The error over a defined time is added up (integrated), and the control variable is increased/decreased based on this cumulative error
• Differential (D) Control: The rate of change of the error with respect to time is measured, and the control variable is increased/decreased based on this rate-of-change

The control variable in the PID control system is determined by the combined effects of all three components. The balance between the three is determined through Tuning, which determines the optimal constants for the three terms in the control function.

In addition to the integrated PID controller, we can also have proportional-integral (PI), proportional-differential (PD), purely proportional (P), etc., controllers that are more effective for a given system.

### Optimising digital marketing campaigns

Global digital ad spending is expected to increase by 15.2 per cent over the last year and reach \$524.31 billion in 2022. According to Statista, programmatic advertising remains the leading approach for buying and selling digital ad space, with global programmatic ad spend reaching 82 per cent in 2022. Nearly 41 per cent of marketers say that AI and machine learning have had the most impact on their revenue growth and performance.

So, how does the PID control approach apply in digital marketing?

In a relatively simplified way, by applying the system definitions described above, we can view them as follows:

• State variable: The KPIs of the campaign – Impressions, views, clicks, CPA, CPC, etc. on a daily basis, daily budget available
• Set point: The target number of impressions, views, clicks, CPA, CPC, etc., on a daily basis, a budget that needs to be consumed on a daily basis, etc.
• Measured value: Actual value of the impressions, views, clicks, CPA, CPC, etc. observed on a given day, actual budget consumed daily
• Error: Difference between the target & actual values of the state variables
• Control variable: Bidding strategy

Consequently, for a given campaign, by continuously measuring the error between the target and actual value(s) of the KPI(s) and formulating and tuning the PID control function, we can determine the optimal bidding strategy.

For executing this approach on real campaigns, some nuances that need to be kept in mind include

• What is the right frequency at which the bidding strategy (control action) should be taken – should it be daily or more frequent than that?
• How does one translate the end-of-campaign KPI targets to intermediate set point targets?
• How do you consider the interdependency of various KPIs so that optimising one doesn’t adversely impact others?

### Wrapping up

This comes in handy; say, you want to make your website or app more responsive to the dynamic behaviour of the users. By applying these steps, you can optimise your marketing campaigns efficiently and seamlessly.

## Our Upcoming Events

### Telegram group

Discover special offers, top stories, upcoming events, and more.

### Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

### Apple Should be Scared of Windows Copilot

Copilot will start its early rollout as part of the free Windows 11 update, beginning on September 26

### Top 5 Libraries in C/C++ for ML in 2023

There are tons of libraries in C/C++ for ML, such as TensorFlow, Caffe, and mlpack

### Tesla Optimus Finally Learns Yoga, Performs Vrikshasana

Jim Fan, senior AI scientist at NVIDIA, has come forward with insights on how exactly Optimus functions with such brilliance

### NVIDIA’s Dominance Set to Surge Further

NVIDIA’s Meteoric Rise in 2023: On Track to Surpass \$50 Billion Revenue, Achieves \$1 Trillion Market Cap, and Forges Global Partnerships for AI Dominance.

### 6 Brilliant JavaScript Frameworks for Every Developer

Although Python and R are more famous for machine learning, Java can serve this purpose effectively, especially if you’re already familiar with it

### Meet the Researcher Curing the Healthcare System with ML

Ziad Obermeyer is bringing the long-delayed impact of ML in healthcare

### Why Focus on Future AI Regulations When Deepfake Crimes Persist?

With discussions on AI regulations happening on one side, and deepfake crimes increasing on the other, shouldn’t the present be checked before moving to the future?

### Can Stability AI and Meta Meet OpenAI’s Multimodal Challenge?

Llama 3 is anticipated to introduce open-source multimodal capabilities

### How Oracle is Fuelling Musk’s Ambitions

“This guy is landing rockets on robot drones. Who else is landing rockets? Who are you?” said Larry about Elon.