Raven's Progressive Matrices

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

The project is to create an AI agent that can pass a human intelligence test.

You’ll download a code package that contains the boilerplate necessary to


run an agent you design against a set of problems inspired by the Raven’s
Progressive Matrices test of intelligence. Within it, you’ll implement the
Agent.py file to take in a problem and return an answer.
There are two sets of problems for your agent to answer: B, C, D, and E.
Each set contains two types of problems: Basic and Challenge. You’ll be
able to see the Basic and Challenge problems while designing your agent,
and your grade will be based on your agent’s answers to the Basic and Test
problems. First you’ll target the first set of problems, the relatively easy 2x2
problems from Set B. Then you’ll move on to the second set of problems,
the more challenging 3x3 problems from Set C. Finally, you’ll look at the
more difficult Set D and Set E problems, building toward the final
deliverable a bit later.
For all problems, your agent will be given images that represent the
problem in .png format. An example of a full problem is shown below; your
agent would be given separate files representing the contents of squares A,
B, C, 1, 2, 3, 4, 5, and 6.
About the Test
The full Raven’s Progressive Matrices test consists of 60 visual analogy
problems divided into four sets: B, C, D, and E. Set B is comprised of 12
2x2 matrix problems, such as the first image shown above. Sets C, D, and
E are each comprised of 12 3x3 matrix problems, such as the second
image shown above. Problems are named with their set followed by their
number, such as problem B-05 or C-11. The sets are of roughly ascending
difficulty.
Each problem set (that is, Set B, Set C, Set D, and Set E) consists of 24
problems: 12 Basic and 12 Challenge. The problems themselves generally
ascend in difficulty from set to set (although many people reflect that Set E
is a bit easier than Set D.

Project Milestones
3/21/2021
• Deadline 1 : Set B, all problems. As long as your agent
can answer 5 (out of 12) Basic B
• Set C. The goal is to ensure you have generalized your approach out
to the more difficult 3x3 problems As long as your agent can answer 5
(out of 12) Basic C.
• Deadline 2: (4/2/2021) Sets D and E. The goal of this milestone is to
ensure you have looked at all four sets before the final project
deadline, so that you may spend the last portion of the semester
refining, improving, and writing your final report. As long as your
agent can answer 10 (out of 24) Basic D & E.On each milestone, your
grade will be 50% meeting the performance expectations and 50%
the report you write up.

The Problems
You are provided with the Basic and Challenge problems to use in
designing your agent.

All problems are contained within the Problems folder of the downloadable.
Problems are divided into sets, and then into individual problems. Each
problem’s folder has three things:
• The problem itself, for your benefit.
• A ProblemData.txt file, containing information about the problem,
including its correct answer and its type.
• Visual representations of each figure, named A.png, B. png, etc.
You should not attempt to access ProblemData.txt directly; its filename will
be changed when we grade projects. Generally, you need not worry about
this directory structure; all problem data will be loaded into the
RavensProblem object passed to your agent’s Solve method, and the
filenames for the different visual representations will be included in their
corresponding RavensFigures.
Working with the Code
The framework code is available under Getting Started above. You may
modify ProblemSetList.txt to alter what problem sets your code runs
against locally; this will be useful early in the term when you probably do
not need to bother thinking about later problem sets yet.
The Code
The downloadable package has a number of Python files: RavensProject,
ProblemSet, RavensProblem, RavensFigure, and Agent. Of these, you
should only modify the Agent class. You may make changes to the other
classes to test your agent, write debug statements, etc. However, when we
test your code, we will use the original versions of these files as
downloaded here. Do not rely on changes to any class except for Agent to
run your code. In addition to Agent, you may also write your own additional
files and classes for inclusion in your project.
In Agent, you will find two methods: a constructor and a Solve method. The
constructor will be called at the beginning of the program, so you may use
this method to initialize any information necessary before your agent begins
solving problems. After that, Solve will be called on each problem. You
should write the Solve method to return its answer to the given question:
• 2x2 questions have six answer options, so to answer the question,
your agent should return an integer from 1 to 6.
• 3x3 questions have eight answer options, so your agent should return
an integer from 1 to 8.
• If your agent wants to skip a question, it should return a negative
number. Any negative number will be treated as your agent skipping
the problem.
You may do all the processing within Solve, or you may write other
methods and classes to help your agent solve the problems.
When running, the program will load questions from the Problems folder. It
will then ask your agent to solve each problem one by one and write the
results to ProblemResults.csv. You may check ProblemResults.csv to see
how well your agent performed. You may also check SetResults.csv to view
a summary of your agent’s performance at the set level.
The Documentation
Included in the downloadable is the documentation for interacting with the
code (API/index.html in the downloadable). You may use this and the in-line
comments to understand the structure of the problems. Briefly, however:
• RavensProject: The main driver of the project. This file will load the
list of problem sets, initialize your agent, then pass the problems to
your agent one by one.
• RavensGrader: The grading file for the project. After your agent
generates its answers, this file will check the answers and assign a
score.
• Agent: The class in which you will define your agent. When you run
the project, your Agent will be constructed, and then its Solve method
will be called on each RavensProblem. At the end of Solve, your
agent should return an integer as the answer for that problem (or a
negative number to skip that problem).
• ProblemSet: A list of RavensProblems within a particular set.
• RavensProblem: A single problem, such as the one shown earlier in
this document. A RavensProblem includes:
• A Dictionary of the individual Figures (that is, the squares
labeled “A”, “B”, “C”, “1”, “2”, etc.) from the problem. The
RavensFigures associated with keys “A”, “B”, and “C” are the
problem itself, and those associated with the keys “1”, “2”, “3”,
“4”, “5”, and “6” are the potential answer choices.
• A String representing the name of the problem and a String
representing the type of problem (“2x2” or “3x3”).
• RavensFigure: A single square from the problem, labeled either “A”,
“B”, “C”, “1”, “2”, etc., containing a filename referring to the visual
representation (in PNG form) of the figure’s contents
The documentation is ultimately somewhat straightforward, but it can be
complicated when you’re initially getting used to it. The most important
things to remember are:
• Every time Solve is called, your agent is given a single problem. By
the end of Solve, it should return an answer as an integer. You don’t
need to worry about how the problems are loaded from the files, how
the problem sets are organized, or how the results are printed. You
need only worry about writing the Solve method, which solves one
question at a time.
• RavensProblems have a dictionary of RavensFigures, with each
Figure representing one of the image squares in the problem and
each key representing its letter (squares in the problem matrix) or
number (answer choices). All RavensFigures have filenames so your
agent can load the PNG with the visual representation.

Libraries
The permitted libraries for this term’s project are:
• The Python image processing library Pillow (version 8.1.0). For
installation instructions on Pillow, see this page.
• The latest version of the Numpy library (1.19.1 at time of writing). For
installation instructions on numpy, see this page.
• A recent version of OpenCV (4.2.0, opencv-contrib-python-headless).
For installation instructions, see this page.
Additionally, we use Python 3.8.0 for our autograder.

You might also like