CS50's Introduction to Artificial Intelligence Test Scripts

Overview

CS50's Introduction to Artificial Intelligence Test Scripts

๐Ÿคทโ€โ™‚๏ธ What's this? ๐Ÿคทโ€โ™€๏ธ

This repository contains Python scripts to automate tests for most of the CS50โ€™s Introduction to Artificial Intelligence with Python projects.

It does not contain any project solution/spoiler, as per the course's Academic Honesty policy.

โ›” Disclaimer

This is a student-initiated project. Passing these test cases does not guarantee that you will receive a full grade from the official CS50 AI's teaching team.

๐Ÿ“– Table of Contents

Lecture Concept Project Test Script Description
Search Breadth First Search Degrees degrees_test.py Run test cases given by problem description and this discussion
Search Minimax Tic-Tac-Toe tictactoe_test.py Let your AI play against itself for 10 rounds
Knowledge Model Checking Knights puzzle_test.py Check the correctness of the 4 puzzle results
Knowledge Knowledge Engineering Minesweeper minesweeper_test.py Check if your AI has โ‰ˆ90% win rate over 1000 simulations
Uncertainty Bayesian Networks Heredity heredity_test.py Run test cases given by problem description and this discussion
Uncertainty Markov Models PageRank pagerank_test.py Compare the output of the 2 implemented functions
Optimization Constraint Satisfaction Crossword generate_test.py Generate crosswords using all 9 different structure + words combination and a special test case from this discussion
Learning Nearest-Neighbor Classification Shopping shopping_test.py Check the information is parsed correctly and result is within a reasonable range
Learning Reinforcement Learning Nim nim_test.py Check if the AI which moves second has a 100% win rate

๐Ÿ› ๏ธ How to Run Tests

Guide

  1. Make sure you have Python3 installed in your machine. Anything above Python 3.4+ should work.
  2. Install pytest by running pip install pytest in a terminal. More information about pip here.
  3. Make a copy of the test file and paste it in the same folder as the project that you want to test.

    For example, if you want to test your code for degrees.py, make a copy of degrees_test.py in the same folder as your degrees.py and other files that came along with the project, like util.py, large/ and small/.

  4. Navigate to the project folder and run pytest or pytest _test.py in a terminal.

    For example, navigate to degrees/ and run pytest or pytest degrees_test.py.

Example

example

๐Ÿšฉ Useful pytest Flags

  • Run pytest -s to show print statements in the console
  • Run pytest -vv for verbose mode
  • Combine both flags pytest -s -vv for extra verbose mode
  • Run pytest --durations=n to see the n slowest execution time
  • Install pytest-repeat with pip and then run pytest --count n to repeat the test for n times

๐Ÿ’ป My Setup

Each test should take less than 30 seconds, depending on Python's I/O and your code efficiency.

  • Windows 10 Home Build 19042
  • Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  • Python 3.9.5 64-bit
  • Visual Studio Code w/Pylance (latest release)

๐Ÿ† Acknowledgement

Special thanks to these fellow CS50AI classmates who contributed some of the test cases on the Ed discussion site!

  • Ken Walker
  • Naveena A S
  • Ricardo L
Owner
Jet Kan
Tutor and Computer Science Undergraduate, National University of Singapore (NUS)
Jet Kan
Experiments for Fake News explainability project

fake-news-explainability Experiments for fake news explainability project This repository only contains the notebooks used to train the models and eva

Lorenzo Flores (Lj) 1 Dec 03, 2022
ILVR: Conditioning Method for Denoising Diffusion Probabilistic Models (ICCV 2021 Oral)

ILVR + ADM This is the implementation of ILVR: Conditioning Method for Denoising Diffusion Probabilistic Models (ICCV 2021 Oral). This repository is h

Jooyoung Choi 225 Dec 28, 2022
๐Ÿ”ฅ Cannlytics-powered artificial intelligence ๐Ÿค–

Cannlytics AI ๐Ÿ”ฅ Cannlytics-powered artificial intelligence ๐Ÿค– ๐Ÿ—๏ธ Installation ๐Ÿƒโ€โ™€๏ธ Quickstart ๐Ÿงฑ Development ๐Ÿฆพ Automation ๐Ÿ’ธ Support ๐Ÿ›๏ธ License ?

Cannlytics 3 Nov 11, 2022
Open-World Entity Segmentation

Open-World Entity Segmentation Project Website Lu Qi*, Jason Kuen*, Yi Wang, Jiuxiang Gu, Hengshuang Zhao, Zhe Lin, Philip Torr, Jiaya Jia This projec

DV Lab 410 Jan 03, 2023
CAUSE: Causality from AttribUtions on Sequence of Events

CAUSE: Causality from AttribUtions on Sequence of Events

Wei Zhang 21 Dec 01, 2022
Official implementation of the article "Unsupervised JPEG Domain Adaptation For Practical Digital Forensics"

Unsupervised JPEG Domain Adaptation for Practical Digital Image Forensics @WIFS2021 (Montpellier, France) Rony Abecidan, Vincent Itier, Jeremie Boulan

Rony Abecidan 6 Jan 06, 2023
Time should be taken seer-iously

TimeSeers seers - (Noun) plural form of seer - A person who foretells future events by or as if by supernatural means TimeSeers is an hierarchical Bay

279 Dec 26, 2022
In this project we use both Resnet and Self-attention layer for cat, dog and flower classification.

cdf_att_classification classes = {0: 'cat', 1: 'dog', 2: 'flower'} In this project we use both Resnet and Self-attention layer for cdf-Classification.

3 Nov 23, 2022
Prediction of MBA refinance Index (Mortgage prepayment)

Prediction of MBA refinance Index (Mortgage prepayment) Deep Neural Network based Model The ability to predict mortgage prepayment is of critical use

Ruchil Barya 1 Jan 16, 2022
Classic Papers for Beginners and Impact Scope for Authors.

There have been billions of academic papers around the world. However, maybe only 0.0...01% among them are valuable or are worth reading. Since our limited life has never been forever, TopPaper provi

Qiulin Zhang 228 Dec 18, 2022
HiFi-GAN: High Fidelity Denoising and Dereverberation Based on Speech Deep Features in Adversarial Networks

HiFiGAN Denoiser This is a Unofficial Pytorch implementation of the paper HiFi-GAN: High Fidelity Denoising and Dereverberation Based on Speech Deep F

Rishikesh (เค‹เคทเคฟเค•เฅ‡เคถ) 134 Dec 27, 2022
Instance-based label smoothing for improving deep neural networks generalization and calibration

Instance-based Label Smoothing for Neural Networks Pytorch Implementation of the algorithm. This repository includes a new proposed method for instanc

Mohamed Maher 1 Aug 13, 2022
SphereFace: Deep Hypersphere Embedding for Face Recognition

SphereFace: Deep Hypersphere Embedding for Face Recognition By Weiyang Liu, Yandong Wen, Zhiding Yu, Ming Li, Bhiksha Raj and Le Song License SphereFa

Weiyang Liu 1.5k Dec 29, 2022
PyTorch implementations of the beta divergence loss.

Beta Divergence Loss - PyTorch Implementation This repository contains code for a PyTorch implementation of the beta divergence loss. Dependencies Thi

Billy Carson 7 Nov 09, 2022
Generic Foreground Segmentation in Images

Pixel Objectness The following repository contains pretrained model for pixel objectness. Please visit our project page for the paper and visual resul

Suyog Jain 157 Nov 21, 2022
The implementation of our CIKM 2021 paper titled as: "Cross-Market Product Recommendation"

FOREC: A Cross-Market Recommendation System This repository provides the implementation of our CIKM 2021 paper titled as "Cross-Market Product Recomme

Hamed Bonab 16 Sep 12, 2022
Collective Multi-type Entity Alignment Between Knowledge Graphs (WWW'20)

CG-MuAlign A reference implementation for "Collective Multi-type Entity Alignment Between Knowledge Graphs", published in WWW 2020. If you find our pa

Bran Zhu 28 Dec 11, 2022
Python implementation of the multistate Bennett acceptance ratio (MBAR)

pymbar Python implementation of the multistate Bennett acceptance ratio (MBAR) method for estimating expectations and free energy differences from equ

Chodera lab // Memorial Sloan Kettering Cancer Center 169 Dec 02, 2022
An experimentation and research platform to investigate the interaction of automated agents in an abstract simulated network environments.

CyberBattleSim April 8th, 2021: See the announcement on the Microsoft Security Blog. CyberBattleSim is an experimentation research platform to investi

Microsoft 1.5k Dec 25, 2022
Learning to Reconstruct 3D Non-Cuboid Room Layout from a Single RGB Image

NonCuboidRoom Paper Learning to Reconstruct 3D Non-Cuboid Room Layout from a Single RGB Image Cheng Yang*, Jia Zheng*, Xili Dai, Rui Tang, Yi Ma, Xiao

67 Dec 15, 2022