This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tic Tac Toe | |
# Initialize Board class and define methods | |
class Board: | |
def __init__(self): | |
""" This is the state of the game, where 0 = occupied by O, 1 = occupied by X, None = empty """ | |
self.game_state = [[None, None, None], [None, None, None], [None, None, None]] | |
self.board_full = False | |
self.dictionary = {0: 'O', 1: 'X', None: ' '} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implementing a neural network from scratch | |
# Input: X, a matrix of predictors | |
# Input: y, a matrix of labels | |
# Return: A matrix of predictions | |
# Architecture: Two layers feedforward neural network | |
import numpy as np | |
# Activation function σ(x) | |
def sigmoid(x): |