0
0
AI for Everyoneknowledge~30 mins

How training data shapes AI behavior in AI for Everyone - Try It Yourself

Choose your learning style9 modes available
How Training Data Shapes AI Behavior
📖 Scenario: You are learning how AI systems learn from examples. Imagine you want to teach a simple AI to recognize fruits based on their color and size.
🎯 Goal: Build a simple data set of fruits, set a rule to decide if a fruit is 'likely an apple', and apply that rule to classify the fruits.
📋 What You'll Learn
Create a dictionary called fruits with fruit names as keys and their attributes as values (color and size).
Create a variable called apple_color and set it to the string 'red'.
Use a dictionary comprehension called apple_likelihood to mark fruits as true if their color matches apple_color and size is 'medium'.
Add a final statement to count how many fruits are likely apples and store it in apple_count.
💡 Why This Matters
🌍 Real World
Understanding how AI uses training data helps in designing fair and accurate AI systems in areas like image recognition and recommendation engines.
💼 Career
This knowledge is important for roles in AI development, data science, and machine learning engineering where data quality directly affects AI behavior.
Progress0 / 4 steps
1
Create the fruit data set
Create a dictionary called fruits with these exact entries: 'banana': {'color': 'yellow', 'size': 'medium'}, 'apple1': {'color': 'red', 'size': 'medium'}, 'apple2': {'color': 'green', 'size': 'small'}, 'cherry': {'color': 'red', 'size': 'small'}.
AI for Everyone
Need a hint?

Use a dictionary with fruit names as keys and another dictionary for their color and size.

2
Set the apple color to look for
Create a variable called apple_color and set it to the string 'red'.
AI for Everyone
Need a hint?

Assign the string 'red' to the variable apple_color.

3
Identify likely apples using a dictionary comprehension
Create a dictionary comprehension called apple_likelihood that goes through fruits.items() and sets the value to true if the fruit's color equals apple_color and its size is 'medium', otherwise false.
AI for Everyone
Need a hint?

Use a dictionary comprehension with for fruit, info in fruits.items() and check both color and size.

4
Count how many fruits are likely apples
Create a variable called apple_count that sums the true values in apple_likelihood.values().
AI for Everyone
Need a hint?

Use the sum() function on the values of apple_likelihood to count true entries.