0% found this document useful (0 votes)
15 views12 pages

#Body

The document discusses uninformed learning algorithms in machine learning. It explains that uninformed learning algorithms make decisions based only on the given problem instance without any additional domain knowledge or guidance. These algorithms primarily rely on systematically searching the problem space to find a solution. One common example is the breadth-first search algorithm used in search problems and AI applications to explore all nodes at each depth level before moving deeper. While effective in some cases, uninformed learning approaches can be inefficient for complex problems due to exhaustive searching.

Uploaded by

hammoudi.yousuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views12 pages

#Body

The document discusses uninformed learning algorithms in machine learning. It explains that uninformed learning algorithms make decisions based only on the given problem instance without any additional domain knowledge or guidance. These algorithms primarily rely on systematically searching the problem space to find a solution. One common example is the breadth-first search algorithm used in search problems and AI applications to explore all nodes at each depth level before moving deeper. While effective in some cases, uninformed learning approaches can be inefficient for complex problems due to exhaustive searching.

Uploaded by

hammoudi.yousuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Introduction:

Uninformed learning, in the context of machine learning and artificial intelligence, refers to a
category of learning algorithms that make decisions based on limited or no prior knowledge
about the problem they're trying to solve. These algorithms don't have access to additional
domain-specific information or guidance beyond the given problem instance.

Uninformed learning algorithms primarily rely on searching through the problem space
systematically to find a solution. They explore different possibilities without using any domain-
specific knowledge or heuristics. They tend to operate in a brute-force manner, evaluating all
possible options until an acceptable solution is found.

One of the most common examples of uninformed learning is the breadth-first search algorithm,
used in search problems, graph traversal, and certain AI applications. It explores all possible
nodes at a given depth level before moving to the next level, making decisions based solely on
the current state without any additional insights or guidance.

While uninformed learning approaches can be effective in certain scenarios, they might not be
efficient when dealing with complex problems or large search spaces. They often require
extensive computational resources and time as they exhaustively search through the entire
solution space without leveraging any specific domain knowledge.

#body
In uninformed learning, algorithms often focus on systematically exploring the search space
without utilizing additional domain-specific knowledge. Some important algorithms in this
category include:

Breadth-First Search (BFS): Traverses a graph level by level, exploring all neighbors of a node
before moving to the next level. It's complete and guarantees the shortest path in terms of
edges for unweighted graphs.

Depth-First Search (DFS): Explores as far as possible along each branch before backtracking,
going deeper into the graph. It's often used in topological sorting, maze generation, and graph
traversal.

Uniform-Cost Search (UCS): Similar to BFS but accounts for edge weights, choosing the path
with the lowest total cost. It's commonly used in finding the least-cost path in graphs with
weighted edges.

Iterative Deepening Depth-First Search (IDDFS): A hybrid of BFS and DFS, iteratively
increasing the depth limit in DFS until the goal is found. It combines the completeness of BFS
with the low memory requirement of DFS.
Bidirectional Search: Runs two simultaneous searches from the start and goal nodes until they
meet in the middle. It's particularly useful in reducing the search space for path-finding
problems.

Greedy Best-First Search: Prioritizes nodes for exploration based on a heuristic function,
favoring nodes that are closer to the goal. It's not guaranteed to find the optimal solution but is
efficient in certain scenarios.
Pathfinding Algorithms: Used in navigation systems, gaming, robotics, and logistics to find the
shortest path between two points. BFS, DFS, UCS, and A* are commonly employed here.

Network Routing: Algorithms like Dijkstra's (a variant of UCS) are used to find the optimal path
in computer networks for data transmission.

Maze Generation and Solving: DFS and BFS are used to generate mazes and solve them by
finding paths from the start to end points.

Web Crawling and Search Engines: BFS is used in web crawlers to systematically navigate
through web pages, while DFS can be applied in certain contexts.

AI and Puzzle Solving: Algorithms like DFS, BFS, and A* are used in solving puzzles, logic
problems, and AI planning tasks.

Optimization Problems: UCS and A* are employed in solving optimization problems, such as
scheduling, resource allocation, and production planning.

Robotics and Autonomous Vehicles: Path planning algorithms (like A*) are crucial for
autonomous vehicles and robotic systems to navigate in real-world environments.

Artificial Intelligence and Game Playing: Various search algorithms, including minimax with
alpha-beta pruning, are used in games like chess, checkers, and Go to make intelligent moves.
# definitions
BFS

Breadth-First Search (BFS) is an algorithm used for traversing or searching tree


or graph data structures. It explores all the neighbor nodes at the present depth
before moving on to the nodes at the next level of depth. BFS visits nodes level
by level, starting from the root (or any arbitrary node in a graph), moving to all
neighboring nodes at the current depth level before moving to the nodes at the
next level.

Here's a clear definition:

BFS starts at the root node and explores all of its neighbors at the present depth
level before moving on to the nodes at the next level. It continues this process
until it has visited all the nodes in the graph or tree, visiting the nodes in a
breadthward motion.

Applications of BFS include:

Shortest Path and Optimizations: BFS can be used to find the shortest path
between two nodes in an unweighted graph or a tree.

Crawlers in Search Engines: Search engines use BFS to crawl the web and
index pages. BFS ensures that the pages are indexed by levels, avoiding
redundant page visits.

Social Networking: In social networks, BFS can be used to find people within a
certain distance or number of connections from a user.

Minimum Spanning Tree: BFS can be used to find the minimum spanning tree in
a graph.

Garbage Collection in Memory Management: BFS is used to determine which


objects are reachable and which are not, aiding in garbage collection.

Network Broadcasting: In network data transfer, BFS is used to broadcast


packets to all devices in a network.
DFS
Depth-First Search (DFS) is an algorithm used for traversing or searching tree or
graph data structures. It explores as far as possible along each branch before
backtracking. DFS recursively visits nodes, going as deep as possible down one
branch before backtracking and exploring other branches.

Here's a clear definition:

DFS starts at the root (or any arbitrary node in a graph), explores as far as
possible along each branch before backtracking, and continues this process until
it reaches the end of a branch, then it backtracks and explores other branches.

Applications of DFS include:

1. Traversal: DFS can be used to traverse trees or graphs, visiting all the nodes
and edges.

2. Path Finding: It can find paths between two nodes, although it does not
guarantee the shortest path (unlike BFS in an unweighted graph).

3. Topological Sorting: DFS can be used to perform topological sorting in


directed acyclic graphs (DAGs).

4. Cycle Detection: It can determine whether a graph has cycles or is acyclic.

5. Connected Components: DFS can determine the connected components of a


graph.

6. Maze Generation and Solving: DFS can be used to generate mazes and solve
puzzles by exploring all possible paths.

DFS's ability to deeply explore and backtrack makes it useful for various
applications, especially in scenarios where a systematic exploration of paths or
connected components in a graph or tree is required.

UCS
Uniform Cost Search (UCS) is a graph traversal algorithm used for finding the
lowest-cost path to reach a goal state from a given starting state in a weighted
graph. Unlike BFS or DFS, which focus on exploring nodes by level or depth,
UCS considers the cost of edges between nodes to determine the optimal path.

Here's a clear definition:

UCS starts from the initial node and expands the least-cost node first. It
continually selects the node with the lowest cost (the path with the smallest
accumulated weight) among the available options, expanding its neighbors and
updating the cost to each neighbor until it reaches the goal node.

Applications of UCS include:

1. Routing Algorithms: UCS is used in routing protocols to find the shortest path
between nodes in computer networks, where edge costs represent factors like
latency or bandwidth.

2. GPS Navigation: UCS is employed in GPS navigation systems to find the


optimal routes between locations based on road networks, considering factors
such as distance or time.

3. AI Search Problems: In artificial intelligence, UCS is used in various search


problems, such as finding optimal solutions in games like chess or pathfinding in
mazes.

4. Robotics: UCS helps robots navigate and plan paths in environments with
varying terrains or obstacles by finding the most cost-efficient paths.

5. Resource Allocation: It's used in resource allocation problems where costs


need to be optimized, such as allocating resources in manufacturing processes
or task scheduling in project management.

UCS's ability to find the lowest-cost path makes it valuable in scenarios where
the cost of traversal between nodes or states needs to be minimized, allowing it
to be used in various optimization and pathfinding problems.
# implementation

BFS

from collections import deque

def bfs(graph, start):


visited = set()
queue = deque([start])
visited.add(start)

while queue:
current_node = queue.popleft()
print(current_node) # You can process or store the
visited node here

for neighbor in graph[current_node]:


if neighbor not in visited:
visited.add(neighbor)
queue.append(neighbor)

# Example graph represented as an adjacency list


graph = {
'A': ['B', 'C'],
'B': ['A', 'D', 'E'],
'C': ['A', 'F', 'G'],
'D': ['B'],
'E': ['B', 'H'],
'F': ['C'],
'G': ['C'],
'H': ['E']
}
# Starting node for BFS traversal
start_node = 'A'
bfs(graph, start_node)

DFS
# DFS function
def dfs(graph, start, visited):
visited.add(start) # Mark the current node as visited
print(start) # Process the current node (print or
store)

# Traverse adjacent nodes recursively


for neighbor in graph[start]:
if neighbor not in visited:
dfs(graph, neighbor, visited)

# Example graph represented as an adjacency list


graph = {
'A': ['B', 'C'],
'B': ['A', 'D', 'E'],
'C': ['A', 'F', 'G'],
'D': ['B'],
'E': ['B'],
'F': ['C'],
'G': ['C']
}
# Set to track visited nodes
visited = set()
# Perform DFS starting from node 'A'
dfs(graph, 'A', visited)

UCS
import heapq

def uniform_cost_search(graph, start, goal):


# Priority queue to store nodes with their costs
priority_queue = [(0, start)] # (cost, node)
visited = set()

while priority_queue:
cost, current_node = heapq.heappop(priority_queue)

if current_node == goal:
return cost # Return the cost to reach the
goal

if current_node not in visited:


visited.add(current_node)

# Explore neighbors and update costs


for neighbor, neighbor_cost in
graph[current_node].items():
if neighbor not in visited:
total_cost = cost + neighbor_cost
heapq.heappush(priority_queue,
(total_cost, neighbor))

return float('inf')
# Return infinity if no path to the goal is found

# Example graph represented as an adjacency list


graph = {
'A': {'B': 4, 'C': 3},
'B': {'C': 1, 'D': 5},
'C': {'D': 8},
'D': {}
}

# Start and goal nodes


start_node = 'A'
goal_node = 'D'

# Find the cost of the shortest path from start to goal


result = uniform_cost_search(graph, start_node, goal_node)
print(f"The cost of the shortest path from {start_node} to
{goal_node} is: {result}")

#pseudocode
Bfs

BFS(graph, startNode):
// Initialize an empty queue and set to track visited
nodes
queue = Queue()
visited = Set()

// Add the start node to the queue and mark it as


visited
queue.enqueue(startNode)
visited.add(startNode)

// While the queue is not empty


while queue is not empty:
// Dequeue a node from the front of the queue
currentNode = queue.dequeue()

// Process or store the visited node (e.g., print


or save it)

// Explore neighbors of the current node


for neighbor in graph.adjacentNodes(currentNode):
if neighbor is not in visited:
// Mark neighbor as visited and enqueue it
for further exploration
visited.add(neighbor)
queue.enqueue(neighbor)

DFS
function uniform_cost_search(graph, start, goal):
priority_queue = PriorityQueue() // Initialize a
priority queue
priority_queue.push((0, start)) // (cost, node)
visited = set()

while priority_queue is not empty:


cost, current_node = priority_queue.pop()

if current_node equals goal:


return cost // Return the cost to reach the
goal

if current_node is not in visited:


visited.add(current_node)

for each neighbor, neighbor_cost in


graph[current_node]:
if neighbor is not in visited:
total_cost = cost + neighbor_cost
priority_queue.push((total_cost,
neighbor))

return infinity // Return infinity if no path to the


goal is found

UCS

function uniform_cost_search(graph, start, goal):


priority_queue = PriorityQueue() // Initialize a
priority queue
priority_queue.push((0, start)) // (cost, node)
visited = set()

while priority_queue is not empty:


cost, current_node = priority_queue.pop()

if current_node equals goal:


return cost // Return the cost to reach the
goal

if current_node is not in visited:


visited.add(current_node)

for each neighbor, neighbor_cost in


graph[current_node]:
if neighbor is not in visited:
total_cost = cost + neighbor_cost
priority_queue.push((total_cost,
neighbor))
return infinity // Return infinity if no path to the
goal is found

You might also like