wshine ai hw1 - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki

Ai Homework 1

notes
Chapter 1

perceptron: takes multiple binary inputs and produces a single binary output output is calculated by checking if the weighted sum of inputs is greater or less than some threshold

NAND gates are universal to computation, any computation can be built up out of NAND gates. We can also use perceptrons to simulate nand gates and create simple logic functions

2024-04-11

quadratic cost function or mean squared error is used to evaluate how well a network is learning.

c(w,b) = 1/2n * sum (|y(x1) - a|**2 ... |y(xn) - a|**2)
2024-04-10
sigmoid(x) = 1/1+e^-x

e: mathematical constant ~2.71. why is this constant used here?

a bias is added before the weighted sum is put through the sigmoid function in order to specifiy what the boundary is for a node to be meaningfully active or inactive.

# integer overflow occurs with large negative numbers
def sigmoid(z):
    output = 0
    if z < 0:
        output = np.exp(z) /(1+np.exp(z))
    else:
        output = 1.0/(1.0+np.exp(-z))
    return output

there are two forms of the sigmoid functions, one seems to cause integer overflow on large negative inputs. I'm not entirely sure why.

reading exercises

find a set of weights and biases for a new output layer that converts the original output layer to a bitwise representation

0 -> 0000
1 -> 0001
2 -> 0010
3 -> 0011
4 -> 0100
5 -> 0101
6 -> 0110
7 -> 0111
8 -> 1000
9 -> 1001

output node 0 fires on inputs 8 or 9
output node 1 fires on inputs 7 or 6 or 5 or 4
output node 2 fires on inputs 7 or 6 or 3 o 2
output node 3 fires on inputs 9 or 7 or 5 or 3 or 1
import numpy as np
from pprint import pprint as print
import math


# integer overflow occurs with large negative numbers
# unsure why this if statment fixes this
def sigmoid(z):
    output = 0
    if z < 0:
        output = np.exp(z) / (1 + np.exp(z))
    else:
        output = 1.0 / (1.0 + np.exp(-z))
    return output


def calc_bitwise_output(weights, input, bias):
    result = []
    for x in input:
        output = []
        for i, w in enumerate(weights):
            o = sigmoid(np.dot(w, x) + bias[i])
            if o > 0.5:
                output.append(1)
            else:
                output.append(0)
        result.append(output)
    return result


weights = [2.07, -1.51, 0.43]
b = 10
inputs = [23, 105, 211]

# 10 nodes -> 4 node output
input = [[0] * 10 for _ in range(10)]
weights = [[-5] * 10 for _ in range(4)]
bias = [1, 1, 1, 1]

# output node 0 fires on inputs 8 or 9
weights[0][9] = 1
weights[0][8] = 1
# output node 1 fires on inputs 7 or 6 or 5 or 4
weights[1][7] = 1
weights[1][6] = 1
weights[1][5] = 1
weights[1][4] = 1
# output node 2 fires on inputs 7 or 6 or 3 o 2
weights[2][7] = 1
weights[2][6] = 1
weights[2][3] = 1
weights[2][2] = 1
# output node 3 fires on inputs 9 or 7 or 5 or 3 or 1
weights[3][9] = 1
weights[3][7] = 1
weights[3][5] = 1
weights[3][3] = 1
weights[3][1] = 1

for i, v in enumerate(input):
    v[i] = 1

expected_outputs = [
    [0, 0, 0, 0],
    [0, 0, 0, 1],
    [0, 0, 1, 0],
    [0, 0, 1, 1],
    [0, 1, 0, 0],
    [0, 1, 0, 1],
    [0, 1, 1, 0],
    [0, 1, 1, 1],
    [1, 0, 0, 0],
    [1, 0, 0, 1],
]
outputs = calc_bitwise_output(weights, input, bias)
assert outputs == expected_outputs
Human Writing

Unjust Enrichment Lawsuit: Actors' Strike 2023 and Grand Moff Tarkin

From my understanding of this article Tyburn Film Productions is arguing that have the rights to resurrecting Cushing because of a prior agreement before he passed away. This would mean Tyburn Film Productions could block others from resurrecting Cushing. The defendents claim to have the right to resurrect him because of a prior agreement as well. The claims are about unjust enrichment in respect of exploitation. The case is not yet resolved and really brings to question the impacts of the advances in CGI, and how this effect performers.

Although not about using technology to resurrect someone, this article Hollywood actors secure safeguards around AI use on screen discusses some recent advancements made for actors right in respect to the use of AI using their images for media. Both articles are related to protecting artists rights from the advances in technology, whether it be CGI or AI.

⚠️ **GitHub.com Fallback** ⚠️