Skip to content

Update lab03.md #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
645b47a
update syllabus, introduce labs
Nov 22, 2023
ca3b4ee
remove lecture links
Nov 22, 2023
1e2924b
update links for exam page
Nov 22, 2023
d63203b
remove old lectures
Nov 22, 2023
527a29d
remove old recitations
Nov 22, 2023
5bc2983
initial draft schedule
Nov 26, 2023
2e9e52e
add note about in-class collaboration
ckaestne Dec 8, 2023
5c48e74
clarify link expectations
ckaestne Jan 10, 2024
c45d315
explain submission to gradescope
ckaestne Jan 10, 2024
5f36a3a
Update homework schedule slightly
ckaestne Jan 10, 2024
05f20aa
adjust grading percentages
ckaestne Jan 10, 2024
19900bc
copy and adjust first two lectures
ckaestne Jan 10, 2024
0e07b15
Merge branch 'main' of github.com:mlip-cmu/s2024 into main
ckaestne Jan 10, 2024
756a10f
add links to schedule
ckaestne Jan 10, 2024
a7b2f4b
add lab 01
ckaestne Jan 17, 2024
3fb8467
add link for lab1
ckaestne Jan 17, 2024
37d0376
fix script to generate pdfs
ckaestne Jan 17, 2024
a82bd4f
fix whitespace issue
ckaestne Jan 17, 2024
1e26bc6
Update lab01.md with repo link
ckaestne Jan 17, 2024
0012cc7
fix link for world vs machine
ckaestne Jan 18, 2024
8925377
Merge branch 'main' of github.com:mlip-cmu/s2024 into main
ckaestne Jan 18, 2024
74fd84c
minor updates to slides of lecture 2
ckaestne Jan 22, 2024
77087d9
requirements slides
clegoues Jan 23, 2024
09d9a5f
add missing image
ckaestne Jan 23, 2024
7aec815
add link the lecture 3
ckaestne Jan 23, 2024
3ae195f
my browser doesn't like tabs for whatever reason
clegoues Jan 23, 2024
5395aa3
Merge branch 'main' of github.com:mlip-cmu/s2024
clegoues Jan 23, 2024
c287e62
add lab 2
ckaestne Jan 24, 2024
4b1d88b
Merge branch 'main' of github.com:mlip-cmu/s2024 into main
ckaestne Jan 24, 2024
3f95f09
Update link in lab02.md
ckaestne Jan 24, 2024
5945423
fix example link in I1
ckaestne Jan 27, 2024
2e0d337
designing for mistakes
clegoues Jan 28, 2024
55a766f
merge
clegoues Jan 28, 2024
144fdc0
slide adjustments
clegoues Jan 29, 2024
111adc9
add lecture slides for lecture 4
ckaestne Jan 29, 2024
459fe7c
add lecture slides 05
ckaestne Jan 29, 2024
7f3f7de
add lecture 06
ckaestne Jan 29, 2024
37676f0
add lecture links
ckaestne Jan 29, 2024
5242605
update homework sequence
ckaestne Jan 29, 2024
65697d0
add links for last two homeworks
ckaestne Jan 29, 2024
d4b1bf3
fix image
ckaestne Jan 31, 2024
9695c06
Create lab03.md
dsouzinator Feb 1, 2024
bc04f86
Merge pull request #1 from dsouzinator/patch-2
ckaestne Feb 1, 2024
9ce2764
add link for lab3 to schedule
ckaestne Feb 1, 2024
2c73ef7
change lab title
ckaestne Feb 1, 2024
c20db06
Update lab03 - Pull Request Warning
eshetty Feb 2, 2024
4f53f82
Update lab03.md
eshetty Feb 2, 2024
99fad4a
Merge pull request #3 from eshetty/main
clegoues Feb 2, 2024
e7e4b78
Update lab03.md
sayalikandarkar Feb 2, 2024
717f487
Merge branch 'main' into patch-1
sayalikandarkar Feb 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Generate main page
run: |
cp .assets/template.html _site/index.html
sed 's/\](https:\/\/mlip-cmu.github.io\/s2023\/slides\/\([^\(]*\)\.html) (\[/\](https:\/\/mlip-cmu.github.io\/s2023\/slides\/\1.html) ([md](https:\/\/github.com\/mlip-cmu\/s2023\/blob\/main\/lectures\/\1.md), [pdf](https:\/\/mlip-cmu.github.io\/s2023\/slides\/\1.pdf), \[/' < schedule.md | sed 's/\](https:\/\/mlip-cmu.github.io\/s2023\/slides\/\([^\(]*\)\.html) *|/\](https:\/\/mlip-cmu.github.io\/s2023\/slides\/\1.html) ([md](https:\/\/github.com\/mlip-cmu\/s2023\/blob\/main\/lectures\/\1.md), [pdf](https:\/\/mlip-cmu.github.io\/s2023\/slides\/\1.pdf)) |/' > schedule_.md
sed 's/\](https:\/\/mlip-cmu.github.io\/s2024\/slides\/\([^\(]*\)\.html) (\[/\](https:\/\/mlip-cmu.github.io\/s2024\/slides\/\1.html) ([md](https:\/\/github.com\/mlip-cmu\/s2024\/blob\/main\/lectures\/\1.md), [pdf](https:\/\/mlip-cmu.github.io\/s2024\/slides\/\1.pdf), \[/' < schedule.md | sed 's/\](https:\/\/mlip-cmu.github.io\/s2024\/slides\/\([^\(]*\)\.html) *|/\](https:\/\/mlip-cmu.github.io\/s2024\/slides\/\1.html) ([md](https:\/\/github.com\/mlip-cmu\/s2024\/blob\/main\/lectures\/\1.md), [pdf](https:\/\/mlip-cmu.github.io\/s2024\/slides\/\1.pdf)) |/' > schedule_.md
sed -i -e '/^\[Schedule\]/r schedule_.md' README.md
npx marked -i README.md >> _site/index.html
cat .assets/template_end.html >> _site/index.html
Expand Down
89 changes: 48 additions & 41 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assignments/I1_mlproduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Commit all your code changes to your GitHub repository, but *do not commit priva

Additionally upload a short report to Gradescope by [date see Canvas] with the following content:

* **GitHub link:** Start the document with a link to your last commit on GitHub: On the GitHub webpage, click on the last commit message and copy the URL in the format `https://github.com/[user]/[repo]/commit/[commitid]`. Make sure that the link includes the long ID of the last commit.
* **Technical description (1 page max):** Briefly describe how you implemented the two features. Provide pointers to the relevant parts of the code, ideally as direct links to files or even to specific lines on GitHub. We prefer readable links in the PDF rather than hyperlinks behind text (e.g., https://github.com/ckaestne/mlip-s23/blob/main/assignments/I1_mlproduct.md rather than [this](https://github.com/ckaestne/mlip-s23/blob/main/assignments/I1_mlproduct.md)).
* **GitHub link:** Start the document with a link to your last commit on GitHub: On the GitHub webpage, click on the last commit message and copy the URL in the format `https://github.com/cmu-seai/[repo]/commit/[commitid]`. Make sure that the link includes the long ID of the last commit.
* **Technical description (1 page max):** Briefly describe how you implemented the two features. Provide pointers to the relevant parts of the code, ideally as direct links to files or even to specific lines on GitHub. We prefer readable links in the PDF rather than hyperlinks behind text (e.g., https://github.com/mlip-cmu/s2024/blob/main/assignments/I1_mlproduct.md rather than [this](https://github.com/mlip-cmu/s2024/blob/main/assignments/I1_mlproduct.md)).
* **User interface design approach (1 page max):** Recommend for each of the two features how the feature should interact with users (automate, prompt, organize, annotate, hybrid) and why. Justify your recommendation, considering forcefulness, frequency, value, and cost. If your implementation differs from the recommended approach, briefly explain how you would change your implementation if you had more time.
* **Harms (1 page max):** Discuss what possible harms you can anticipate from using machine learning for the features in the applications (e.g., safety, fairness). Identify at least one harm and discuss potential solutions to mitigate the harm. (You do not need to implement the solutions.)
* **Production challenges (1 page max):** Discuss any technical challenges you anticipate if you want to deploy this feature in production (e.g., scalability, operating costs) and how you would change your implementation if you expected millions of users. Identify at least one problem and discuss corresponding potential solutions. (You do not need to implement the solutions.)
Expand Down
48 changes: 0 additions & 48 deletions assignments/I3_architecture.md

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions assignments/I4_explainability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tbd
4 changes: 2 additions & 2 deletions assignments/research_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ If you plan to conduct interviews or surveys as part of the project and you plan

## Deliverables

Submit a draft at the milestone deadlines and a paper and a presentation at the final deadline.
Email a draft to the instructors at the milestone deadlines and submit the paper to Gradescope for the final deadline. Present the work during the final presentation slot of the class.

The paper should be in a form submittable to a new-idea track, short-paper track, or workshop in the field. It should have at least an introduction motivating the research, one or more clear and motivated research questions, a discussion of the state of the art or related work, and a description of the conducted or planned research, and some results. While we do not enforce a specific page limit or formatting requirements, we would typically expect around 4 pages double-column format, such as for the [ICSE-NIER](https://conf.researchr.org/track/icse-2022/icse-2022-nier---new-ideas-and-emerging-results) track.

The presentation should be no longer than 8 minutes. How you structure the presentation is up to you. You do not need to cover everything, but consider how to make this interesting to the audience. It will be presented in the same time slot as the presentations from the group project.

Send drafts, papers and slides as attachments or links per email to the instructors.
Send drafts, papers and slides as attachments or links per email to the instructors. Submit the final paper to Gradescope.

## Grading

Expand Down
17 changes: 9 additions & 8 deletions exams/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ Topic-wise, everything covered in class, in the readings, and in recitation is f

Midterms from previous semesters are available as practice. We expect the midterm to have a similar format, though topic coverage differs slightly between semesters.

* [Practice midterm from Fall 2019](https://github.com/ckaestne/seai/blob/F2019/other_material/practice_midterm.pdf) (corresponds quite well to topics covered this semester)
* [Midterm from Fall 2019](https://github.com/ckaestne/seai/blob/F2019/other_material/midterm.pdf) (we did not cover version control yet)
* [Final from Fall 2019](https://github.com/ckaestne/seai/blob/F2019/other_material/final_exam.pdf) (covers different topics, but provides yet another scenario)
* [Midterm from Summer 2020](https://github.com/ckaestne/seai/blob/S2020/exams/midterm.pdf) (slightly fewer topics covered than this semester)
* [Midterm from Fall 2020](https://github.com/ckaestne/seai/blob/F2020/exams/midterm_f20.pdf) (similar coverage)
* [Midterm from Spring 2021](https://github.com/ckaestne/seai/blob/S2021/exams/) (similar coverage)
* [Midterm from Spring 2022](https://github.com/ckaestne/seai/blob/S2022/exams/) (similar coverage, except data quality and infrastructure quality yet)
* [Midterm from Fall 2022](https://github.com/ckaestne/seai/blob/F2022/exams/) (similar coverage)
* [Practice midterm from Fall 2019](https://github.com/ckaestne/seai/blob/F2019/other_material/practice_midterm.pdf)
* [Midterm from Fall 2019](https://github.com/ckaestne/seai/blob/F2019/other_material/midterm.pdf)
* [Final from Fall 2019](https://github.com/ckaestne/seai/blob/F2019/other_material/final_exam.pdf)
* [Midterm from Summer 2020](https://github.com/ckaestne/seai/blob/S2020/exams/midterm.pdf)
* [Midterm from Fall 2020](https://github.com/ckaestne/seai/blob/F2020/exams/midterm_f20.pdf)
* [Midterm from Spring 2021](https://github.com/ckaestne/seai/blob/S2021/exams/)
* [Midterm from Spring 2022](https://github.com/ckaestne/seai/blob/S2022/exams/)
* [Midterm from Fall 2022](https://github.com/ckaestne/seai/blob/F2022/exams/)
* [Midterm from Spring 2023](https://github.com/mlip-cmu/s2023/tree/main/exams)

46 changes: 46 additions & 0 deletions labs/lab01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Lab 1: Calling, Building, and Securing APIs
In homework I1 you will use third-party machine learning APIs and in the group project you will develop your own APIs. In this lab, you will experiment with both, connecting to the Azure Vision API and providing your own API endpoint.
To receive credit for this lab, show your work to the TA during recitation.

## Deliverables
- [ ] Create an account and connect to the Azure Vision API
- [ ] Explain to the TA why hard-coding credentials is a bad idea. Commit your code to GitHub without committing your credentials.
- [ ] Run the API endpoint with the starter code and demonstrate that it works with an example invocation (e.g., using curl).

## Getting started
Clone the starter code from this Git repository: https://github.com/eshetty/mlip-api-lab

The code implements a flask web application that receives API requests to analyze an image and return information about the image, including the text contained within. To identify the text, the OCR feature of the Azure Vision API [[documentation](https://westcentralus.dev.cognitive.microsoft.com/docs/services/computer-vision-v3-2/operations/56f91f2e778daf14a499f20d#:~:text=test.jpg%22%7D-,Response%20200,-The%20OCR%20results), [response format](https://westcentralus.dev.cognitive.microsoft.com/docs/services/computer-vision-v3-2/operations/56f91f2e778daf14a499f20d#:~:text=test.jpg%22%7D-,Response%20200,-The%20OCR%20results)] can be used by adjusting the API endpoint and credentials in the code. We use the Azure’s provided libraries to abstract from low-level protocol details.

Install the dependencies in the `requirements.txt` file with pip or similar. To set up the flask server, just run `python3 app.py`. The system should try to analyze an example image and report the results when you go to http://localhost:3000/

## Connecting to the Azure Vision API
1. Sign up for the a student account for Microsoft Azure: https://azure.microsoft.com/en-us/free/students/ – no credit card required

2. Create an instance of the Computer Vision service and get an API endpoint of your instance of the service.

3. Get a subscription key to authorize your script to call the Computer Vision API.

4. Update the code with the endpoint and key and test it.

## Secure your Credentials
The starter code hardcodes credentials in the code. This is a bad practice.

Research and discuss best practices, such as never hard-code credentials, never commit credentials to Git, rotate secrets regularly, encrypt your secrets at rest/in-transit if possible, practice least-access privilege on machines where your credentials are stored as environment variables or within local files.

Rewrite the code to load credentials from a file or an environment variable and commit the code without the credentials to GitHub.

## Calling your own API
The starter code comes with a flask server that serves the website at http://localhost:3000/ but also exposes an own API at http://localhost:3000/api/v1/analysis/ accepting a GET request with a JSON object with a single field “uri” pointing to an image to analyze.

Identify how to call your own API with a tool like [curl](https://curl.se/docs/manpage.html) or [Postman](https://www.postman.com).

Optionally extend the API or document it with [Swagger](https://swagger.io).

## Additional resources
- [Redhat article on API](https://www.redhat.com/en/topics/api/what-are-application-programming-interfaces)
- [Azure Computer Vision](https://learn.microsoft.com/en-us/python/api/overview/azure/cognitiveservices-vision-computervision-readme?view=azure-python)
- [API Design Best Practices](https://blog.stoplight.io/crud-api-design?_ga=2.223919515.1813989671.1674077556-1488117179.1674077556)
- [API Endpoint Best Practices](https://www.telerik.com/blogs/7-tips-building-good-web-api)
- The file `seai-azure-cv-ocr-api.json` has the structure to test calls to the Azure Vision API with Postman.

Loading