Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/classroom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Autograding Tests
'on':
- push
- repository_dispatch
permissions:
checks: write
actions: read
contents: read
jobs:
run-autograding-tests:
runs-on: ubuntu-latest
if: github.actor != 'github-classroom[bot]'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: grade1
id: grade1
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: grade1
setup-command: pip install pytest numpy
command: pytest grade_task1.py
timeout: 2
max-score: 1
- name: grade2
id: grade2
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: grade2
setup-command: pip install numpy pytest
command: pytest grade_task2.py
timeout: 2
max-score: 1
- name: grade3
id: grade3
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: grade3
setup-command: pip install numpy pytest
command: pytest grade_task3.py
timeout: 2
max-score: 1
- name: certificate
id: certificate
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: certificate
setup-command: ''
command: if [ -f "certificate.pdf" ]; then echo "File exists"; else echo "File
does not exist"; exit 1; fi
timeout: 2
max-score: 1
- name: Autograding Reporter
uses: classroom-resources/autograding-grading-reporter@v1
env:
GRADE1_RESULTS: "${{steps.grade1.outputs.result}}"
GRADE2_RESULTS: "${{steps.grade2.outputs.result}}"
GRADE3_RESULTS: "${{steps.grade3.outputs.result}}"
CERTIFICATE_RESULTS: "${{steps.certificate.outputs.result}}"
with:
runners: grade1,grade2,grade3,certificate
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/week-1-MarthaBurns.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added certificate.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion grade_task2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from tasks import step, ReLU
from tasks import step, ReLu


def test_relu_default_cutoff():
Expand Down
25 changes: 18 additions & 7 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,38 @@
# Task 1:
# Instructions:
#Write a function that takes one numeric argument as input.
#If the number is larger than zero, the function should return 1, otherwise is should return -1.
#If the number is larger than zero, the function should return 1, otherwise it should return -1.
#The name of the function should be step

# Your code here:
# -----------------------------------------------

def step

def step(num):
if num > 0:
return 1
else:
return -1

# -----------------------------------------------


# Task 2:
# Instructions:
#Write a function that takes in two arguments: a numpy array, and an integer (call argument "cutoff" and set default to 0).
#The function should return a numpy array of the same length, with all elements smaller than the cutoff being set to cutoff).
#The function should return a numpy array of the same length, with all elements smaller than the cutoff being set to cutoff.
#The name of the function should be ReLu


# Your code here:
# -----------------------------------------------
def ReLu

def ReLu(num, cutoff=0):
array = []
for i in range(len(num)):
if num[i] < cutoff:
array.append(cutoff)
else:
array.append(num[i])
return numpy.array(array)

# -----------------------------------------------

Expand All @@ -44,7 +53,9 @@ def ReLu
# Your code here:
# -----------------------------------------------

def neural_net_layer
def neural_net_layer(array_2_dim, array_1_dim):
array = array_2_dim @ array_1_dim
return ReLu(array)


# ------------------------------------------