Loading...

What are Agents in Machine Learning and Artificial Intelligence?

What are Agents in Machine Learning and Artificial Intelligence?

Artificial intelligence and machine learning have become one of the most sought-after technologies in 2022. It is impossible to have well-performing web and mobile-based applications without the power of a machine-learning model that backs up the functionality of these applications and makes them more user-friendly. Imagine a Swiggy that does not recommend dishes, an Amazon that does not recommend what to purchase, and a YouTube that does not recommend related videos to watch – stiff and bland, isn’t it? This article will go through the most fundamental building block of agents machine learning and artificial intelligence – agents. Readers are requested to unlearn their existing knowledge and dive in with a fresh mind to understand every word that has been penned down and crafted to grab your attention toward the necessity of understanding this topic. Without agents, there is no purpose in reading complex machine learning and artificial intelligence algorithms.

Introduction to Agents

Imagine that you are traveling on Delhi Metro from Gurugram to Noida. You can take different routes to reach your location, you can either travel by yellow line and change to the magenta line, or you can travel by yellow line and then change to the blue line. One day when you are going through this route, you have been notified of a delay in the blue line service. Therefore, you took the course which involves the magenta line. However, the next day you have to pick your friend up from a station on the blue line, so you take that route and reach your destination.

What is happening here? You are assessing the elements of your journey and then taking the best route possible to reach your goal destination. In this scenario, you are considered an agent who observes its environment and then makes decisions based on the elements provided. 

In artificial intelligence, agents provide the rationality that enables an algorithm to understand its current environment and act accordingly. The domain’s perception is also called sensing the environment, which is done by sensors. Sensors can be of any form – thermal, light, distance, optical, inertial measurement, environment, etc. which assess the environment according to the program created for them. After collecting the data from the sensors, the agent uses actuators to perform actions.

Let us understand this a little more and also know its associated terminologies. Take an example of a home security system that gets activated as soon as someone enters the home’s vicinity when the system has been activated. What is the agent, architecture, program, and function here?

  1. The agent is the system as a whole.
  2. The architecture is the hardware of the home security system, which contains infrared sensors and alarms as actuators.
  3. The agent program is powered by agent functions that perform calculations on the sensors’ data and decide whether or not to trigger the alarm.

Types of Intelligent Agents

There are broadly three types of intelligent agents. Each of these has been explained below.

Goal Based Agents

Goal-based agents are distinguished by the fact that they have a well-defined goal. The task that they are supposed to undertake is formulated and described in the form of “states.”

For example, we can consider an intelligent agent to which the task of finding the shortest path in a graph full of interconnected nodes has been allotted. The agent starts from a particular node and aims to reach the destination node. 

Goal-based agents perform two types of searches for this problem:

  1. An uninformed search, also called a blind search, has no definite distinction between the agent’s paths. Examples of algorithms that involve an uninformed search or blind search are breadth-first search (BFS) and depth-first search (DFS).
  2. Informed search acts on specific heuristics (parameters) which affect the problem. The algorithms which utilize informed search include greedy search, best-first search, and the A* algorithm.

Knowledge-Based Agents

Knowledge-based agents are agents who have an existing database that is used to define the future actions that the agent will be taking. Continuing the example of traveling in the Delhi metro that we saw in the beginning, if the traveler is an agent, let’s say there is data of the blue line traveling slowly / having more breakdowns than any other string. The agent will use this knowledge to determine the journey’s best route.

Knowledge-based agents tell the knowledge base after gathering data from the environment and then ask the knowledge base before acting with the actuators. 

Learning Based Agents

Learning-based agents are the ones that are used in machine learning. We say that the model “learns” based on data provided however it is not the model that learns but is the agent which understands, and then a model is produced based on the learnings of the intelligent agent. This model is then further tested on test data separately kept for evaluation. Then the output is compared with the expected production to calculate metrics like accuracy, precision, recall, and F1-score.

Several examples of intelligent agents can be used in machine learning. This brilliant agent can classify if an email is spam or regular, an intelligent agent who can predict the stock price. This intelligent agent can group similar items based on past purchase history.

Working with Intelligent Agents

Reflex Agents

There is a reflex agent that senses the environment and notes the state of the territory. The state of the environment depends on how different external things make the environment change and how will the actions of the agent change the state of the domain. After finally assessing the current state of the environment, the agent utilizes the condition-action rules to figure out what action it should take.

Goal-Based Agents

The goal-based agents sense the environment and note the current state of the environment. This current state is affected by how the agent’s actions and external factors change the world. The goal-based agent checks the state of the world after a specific action has been performed. Then based on the agent’s goal, the action is taken through actuators in the environment.

Utility-Based Agents

The utility-based agents sense the environment as well and take into account the current state of the environment. After this, it is measured how the environment will change and how the agents will affect the current state of the environment. The actions are then measured by a happiness score, a performance metric for the utility-based agent based on its happiness, and the action is taken via the actuator into the environment. 

Learning-Based Agents

Learning-based agents sense the environment through sensors and then use an internal mechanism of user feedback, and then make changes according to the performance of the action we are taking, which, when aligned with the learning goals, are transformed into the actions which are to be taken via actuators into the environment.

Conclusion

In this article, we understood what agents are and how it forms the basis of artificial intelligence and machine learning. Having a fundamental understanding of agents enables a machine learning developer to focus on the environment, sensors, and actuators and couple the software with the hardware to create an intelligent agent that is bound to make customers’ lives easier. It is essential to remember that an agent is a combination of hardware and software. The software is the agent function that enables the sensors and actuators to work simultaneously to produce the desired output. An excellent, intelligent agent works to maximize performance/happiness. The most common agents worth knowing about are – reflex agents, goal-based agents, utility-based agents, and learning-based agents. Their description and work have been explained in the article above. Readers are encouraged to try and write pseudo codes or prepare flowcharts for different agents’ working to understand better what is happening under the hood.

Read more about learning paths at codedamn here.

Happy Learning!

Sharing is caring

Did you like what Pooja Gera wrote? Thank them for their work by sharing it on social media.

0/10000

No comments so far