Git Product home page Git Product logo

cs50-ai's Introduction

CS50-AI

I completed the CS50 with AI course by Harvard from January to March of 2023. It consisted of 2 projects completed each week summarised below:

Degrees:

The 7 degrees of Kevin Bacon. I implmented depth first seach on a datset pulled from the IBM api to determine how many far apart any two actors are. Actors who starred in a film together have a distance of 0.

Tic-Tac-Toe:

I implemented mini-max in tic-tac-toe. An inefficient algorithm that solves the game it plays can only be viable for such a small game (especially on my computer).

Knights:

This project was an excercise in propositional logic. Given a set of starting conditions can I algorithmically deduce the role (truth-value) of each knight or knave.

Minesweeper:

I built an algorithm to solve Minesweeper. If there is a safe square available my AI will find it through its internal sets of safe squares and unsafe squares updated after each move. If there is no safe square known, it will heuristically make a decent guess.

PageRank:

I implemented two models to rank a set of pages with links to each other by a set of probabilities. Firstly I used the random surfer, Markov model to travel between pages n times, storing the number of occurrences of each page. Secondly I used the links to develop a recursive summation equation the approximates the same thing. Then iteratively called it until the values stabilized. (Previously I have implemented a matrix to the n-th power solution)

Heredity:

Given a set of parental genotypes of a somatic gene and probabilites of showing the disease phenotype for each genotype and any phenotypic information available about the offspring, I implemented a Baysean network to determine the probabilities of each phenotype in their offspring.

Crossword:

I represent a crossword as a graph structure where the nodes represent words and the edges represent overlapping letters. This allowed me to implement the AC-3 algorithm and recursively backtrack to find a valid arrangement of words. Heuristics make a big difference in run time efficiency in this problem and as such significant time was spent to optimize this problem.

Shopping:

I built a k-Nearest Neighbor classification system to determine whether or not a given shopper on a website was going to make a purchase using tidy data related to the shoppers activity on the website.

Nim:

I implemented Q-learning to play the children's game of Nim. After letting the model play 10,000 games against itself, I was unable to beat it.

Traffic:

Using a convolutional neural network in Tensorflow, I achieved 98% accuracy on identifying road signs in a dataset of 42 different road sigs. Finding a middle ground between accuracy and model complexity (and therefore training time) led me to use 2 convolutional layers and 2 fully connected layers. This compromise trains very quickly on my laptop and still achieves an impressive accruacy rate. To avoid overfitting I also experimented with a drop out rate but I found using a lower percentage of my data to train lead to faster training and also prevented overfitting.

Parser:

I built a set of language rules and used them with nltk to build trees representing the grammar structure of any english sentence (using language from the limited lexicon). To implement more sentences, we would simply need to add more words and their grammatical type. These projects were the earliest version of Natural Language Processing before word2vec or generative AI blew up.

Questions:

Given an input question, this algorithm returns the most relevant sentence from the corpus of documents available. By first ranking each document using the tf-idf algorithm and then ranking each sentence using a similar algorithm, each question can be reasonably assigned to a sentence that is mostly likely to answer their question. But there is no generative aspect in this model, therefore if the question is not answered by a sentence in the corpus then this model is unlikely to produce a satisfying answer.

cs50-ai's People

Contributors

willardford avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.