diff --git a/.github/workflows/classroom.yml b/.github/workflows/classroom.yml new file mode 100644 index 0000000..153514d --- /dev/null +++ b/.github/workflows/classroom.yml @@ -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 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..44ec736 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b802b67 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/week-1-MarthaBurns.iml b/.idea/week-1-MarthaBurns.iml new file mode 100644 index 0000000..c03f621 --- /dev/null +++ b/.idea/week-1-MarthaBurns.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/certificate.pdf b/certificate.pdf new file mode 100644 index 0000000..db0e430 Binary files /dev/null and b/certificate.pdf differ diff --git a/grade_task2.py b/grade_task2.py index c253ca6..48f722a 100644 --- a/grade_task2.py +++ b/grade_task2.py @@ -1,5 +1,5 @@ import numpy as np -from tasks import step, ReLU +from tasks import step, ReLu def test_relu_default_cutoff(): diff --git a/tasks.py b/tasks.py index 1db295e..5e09e2a 100644 --- a/tasks.py +++ b/tasks.py @@ -7,14 +7,17 @@ # 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 # ----------------------------------------------- @@ -22,14 +25,20 @@ def step # 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) # ----------------------------------------------- @@ -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) # ------------------------------------------ \ No newline at end of file