File size: 13,666 Bytes
bee9bbb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | """Source-grounded presentation data for the enrolled representative course.
The question text and option order come from sanitized authenticated evidence.
The private answer key is a clone-local course-knowledge rule: it was not
obtained by submitting answers to Coursera.
"""
from __future__ import annotations
from collections.abc import Mapping, Sequence
from typing import Any
COURSE_ID = "neural-networks-deep-learning"
ASSIGNMENT_ID = "3KFZW"
ASSIGNMENT_SLUG = "introduction-to-deep-learning"
ANSWER_KEY_PROVENANCE = "clone-local-course-knowledge-derived"
PROGRAM = {
"title": "Deep Learning",
"completion_unlock_copy": "Completion date unlocked on Day 3",
"course_titles": (
"Neural Networks and Deep Learning",
"Improving Deep Neural Networks: Hyperparameter Tuning, Regularization and Optimization",
"Structuring Machine Learning Projects",
"Convolutional Neural Networks",
"Sequence Models",
),
}
COURSE = {
"title": "Neural Networks and Deep Learning",
"provider": "DeepLearning.AI",
"position": "Course 1 of 5",
"level": "Intermediate",
"pace": "5 hours a week",
"duration": "roughly 5 weeks",
"language": "English",
"completion": "Pass all graded assignments to complete the course",
"rating": "User Ratings 4.9",
}
MODULES = (
{"week": 1, "label": "Week 1", "title": "Introduction to Deep Learning"},
{"week": 2, "label": "Week 2", "title": "Neural Networks Basics"},
{"week": 3, "label": "Week 3", "title": "Shallow Neural Networks"},
{"week": 4, "label": "Week 4", "title": "Deep Neural Networks"},
)
# Lesson outline per week. Week 1 lessons were directly observed; later-week
# items follow the source syllabus and are presented as not started.
WEEK_ITEMS = {
2: (
("Python Basics with Numpy", "Programming Assignment", 120),
("Logistic Regression as a Neural Network", "Programming Assignment", 120),
("Logistic Regression with a Neural Network mindset", "Programming Assignment", 120),
("Neural Network Basics Quiz", "Graded Quiz", 60),
),
3: (
("Planar Data Classification with One Hidden Layer", "Programming Assignment", 120),
("Building Blocks of Deep Neural Networks", "Programming Assignment", 120),
("Shallow Neural Networks Quiz", "Graded Quiz", 60),
),
4: (
("Building your Deep Neural Network: Step by Step", "Programming Assignment", 120),
("Deep Neural Network for Image Classification: Application", "Programming Assignment", 120),
("Key Concepts on Deep Neural Networks Quiz", "Graded Quiz", 60),
),
}
LESSON = {
"id": "Cuf2f",
"slug": "welcome",
"title": "Welcome",
"module_title": "Introduction to Deep Learning",
}
RESOURCES = (
{"id": "course-notation-sheet", "title": "Course Notation Sheet"},
{"id": "course-acknowledgments", "title": "Course Acknowledgments"},
)
ATTEMPT_RULES = {
"duration_minutes": 50,
"submissions_per_attempt": 1,
"attempts_remaining_after_timeout": 2,
"wait_after_attempts_hours": 24,
"auto_submit_on_timeout": True,
"legal_name_required": True,
}
QUESTIONS: tuple[dict[str, Any], ...] = (
{
"number": 1,
"points": 1,
"type": "single-choice",
"prompt": 'Which of the following best describes the role of AI in the expression "an AI-powered society"?',
"options": (
"AI is an essential ingredient in realizing tasks, in industry and in personal life.",
"AI helps to create a more efficient way of producing energy to power industries and personal devices.",
"AI controls the power grids for energy distribution, so all the power needed for industry and in daily life comes from AI.",
),
},
{
"number": 2,
"points": 1,
"type": "multiple-choice",
"prompt": "Which of the following are reasons that didn't allow Deep Learning to be developed during the '80s?",
"options": (
"Limited computational power.",
"Interesting applications such as image recognition require large amounts of data that were not available.",
"The theoretical tools didn’t exist during the 80’s.",
"People were afraid of a machine rebellion.",
),
},
{
"number": 3,
"points": 1,
"type": "multiple-choice",
"prompt": "Recall this diagram of iterating over different ML ideas. Which of the statements below are true? (Check all that apply.)",
"image": "/static/enrolled/assignment/q3-image-1.png",
"options": (
"Larger amounts of data allow researchers to try more ideas and then produce better algorithms in less time.",
"Better algorithms allow engineers to get more data and then produce better Deep Learning models.",
"Improvements in the GPU/CPU hardware enable the discovery of better Deep Learning algorithms.",
"Better algorithms can speed up the iterative process by reducing the necessary computation time.",
),
},
{
"number": 4,
"points": 1,
"type": "single-choice",
"prompt": "When experienced deep learning engineers work on a new problem, they can usually use insight from previous problems to train a good model on the first try, without needing to iterate multiple times through different models. True/False?",
"options": ("True", "False"),
},
{
"number": 5,
"points": 1,
"type": "single-choice-image",
"prompt": "Which of the following depicts a Sigmoid activation function?",
"options": (
{"label": "A", "image": "/static/enrolled/assignment/q5-image-1.png"},
{"label": "B", "image": "/static/enrolled/assignment/q5-image-2.png"},
{"label": "C", "image": "/static/enrolled/assignment/q5-image-3.png"},
{"label": "D", "image": "/static/enrolled/assignment/q5-image-4.png"},
),
},
{
"number": 6,
"points": 1,
"type": "single-choice",
"prompt": 'Features of animals, such as weight, height, and color, are used for classification between cats, dogs, or others. This is an example of "structured" data, because they are represented as arrays in a computer. True/False?',
"options": (
"True — Yes. The data can be represented by columns of data. This is an example of structured data, unlike images of the animal.",
"False — No. The data can be represented by columns of data. This is an example of structured data, unlike images of the animal.",
),
},
{
"number": 7,
"points": 1,
"type": "single-choice",
"prompt": 'A dataset is composed of age and weight data for several people. This dataset is an example of "structured" data because it is represented as an array in a computer. True/False?',
"options": ("False", "True"),
},
{
"number": 8,
"points": 1,
"type": "multiple-choice",
"prompt": "Why is an RNN (Recurrent Neural Network) used for machine translation, say translating English to French? (Check all that apply.)",
"options": (
"It can be trained as a supervised learning problem.",
"RNNs represent the recurrent process of Idea->Code->Experiment->Idea->....",
"It is applicable when the input/output is a sequence (e.g., a sequence of words).",
"It is strictly more powerful than a Convolutional Neural Network (CNN).",
),
},
{
"number": 9,
"points": 1,
"type": "single-choice",
"prompt": "In this diagram which we hand-drew in the lecture, what do the horizontal axis (x-axis) and vertical axis (y-axis) represent?",
"image": "/static/enrolled/assignment/q9-image-1.png",
"options": (
"x-axis is the amount of data; y-axis (vertical axis) is the performance of the algorithm.",
"x-axis is the amount of data; y-axis is the size of the model you train.",
"x-axis is the performance of the algorithm; y-axis (vertical axis) is the amount of data.",
"x-axis is the input to the algorithm; y-axis is outputs.",
),
},
{
"number": 10,
"points": 1,
"type": "multiple-choice",
"prompt": "Assuming the trends described in the figure are accurate. Which of the following statements are true? Choose all that apply.",
"image": "/static/enrolled/assignment/q10-image-1.png",
"options": (
"Decreasing the training set size generally does not hurt an algorithm’s performance, and it may help significantly.",
"Increasing the training set size of a traditional learning algorithm always improves its performance.",
"Increasing the size of a neural network generally does not hurt an algorithm’s performance, and it may help significantly.",
"Increasing the training set size of a traditional learning algorithm stops helping to improve the performance after a certain size.",
),
},
)
_QUESTION_BY_NUMBER = {int(question["number"]): question for question in QUESTIONS}
# Clone-local course-knowledge rule; never serialize this mapping into a page.
_ANSWER_KEY: dict[int, tuple[int, ...]] = {
1: (0,),
2: (0, 1),
3: (2, 3),
4: (1,),
5: (2,),
6: (0,),
7: (1,),
8: (0, 2),
9: (0,),
10: (2, 3),
}
_FEEDBACK = {
1: "AI is embedded in tasks across industry and everyday life.",
2: "Early deep learning was constrained by computation and the availability of large datasets.",
3: "Faster hardware and computationally efficient algorithms accelerate the idea-to-experiment loop.",
4: "Deep learning development remains iterative, even for experienced engineers.",
5: "The sigmoid curve is smooth, S-shaped, and bounded between zero and one.",
6: "Tabular measurements such as weight, height, and color are structured data.",
7: "Age and weight arranged in columns form structured data.",
8: "Machine translation is supervised sequence-to-sequence learning, a natural use for an RNN.",
9: "The horizontal axis is data volume and the vertical axis is algorithm performance.",
10: "Larger neural networks can help, while traditional algorithms often plateau as data grows.",
}
def question_by_number(number: int) -> dict[str, Any]:
try:
return _QUESTION_BY_NUMBER[int(number)]
except (KeyError, TypeError, ValueError) as exc:
raise ValueError(f"Unknown question: {number}") from exc
def validate_answers(
raw: Mapping[int, Sequence[int]], *, require_complete: bool
) -> dict[int, tuple[int, ...]]:
normalized: dict[int, tuple[int, ...]] = {}
for raw_number, raw_selections in raw.items():
if isinstance(raw_number, bool) or not isinstance(raw_number, int):
raise ValueError(f"Unknown question: {raw_number}")
question = question_by_number(raw_number)
if isinstance(raw_selections, (str, bytes)):
raise ValueError(f"Invalid option selection for question {raw_number}")
selections: list[int] = []
for selection in raw_selections:
if isinstance(selection, bool) or not isinstance(selection, int):
raise ValueError(f"Invalid option for question {raw_number}")
if selection < 0 or selection >= len(question["options"]):
raise ValueError(f"Invalid option for question {raw_number}")
selections.append(selection)
unique = tuple(sorted(set(selections)))
if not unique:
raise ValueError(f"Choose an answer for question {raw_number}")
if question["type"] != "multiple-choice" and len(unique) != 1:
raise ValueError(f"Choose one answer for question {raw_number}")
normalized[raw_number] = unique
if require_complete and set(normalized) != set(_QUESTION_BY_NUMBER):
raise ValueError("Answer every question before submitting")
return normalized
def score_answers(
answers: Mapping[int, Sequence[int]],
) -> list[dict[str, object]]:
normalized = validate_answers(answers, require_complete=True)
scored: list[dict[str, object]] = []
for question in QUESTIONS:
number = int(question["number"])
selected = normalized[number]
correct = selected == _ANSWER_KEY[number]
scored.append(
{
"question_number": number,
"selected": selected,
"correct": correct,
"points_awarded": int(question["points"]) if correct else 0,
"feedback": _FEEDBACK[number],
}
)
return scored
def score_expired_answers(
answers: Mapping[int, Sequence[int]],
) -> list[dict[str, object]]:
"""Score a server-expired draft, treating unanswered items as incorrect."""
normalized = validate_answers(answers, require_complete=False)
scored: list[dict[str, object]] = []
for question in QUESTIONS:
number = int(question["number"])
selected = normalized.get(number, ())
correct = bool(selected) and selected == _ANSWER_KEY[number]
scored.append(
{
"question_number": number,
"selected": selected,
"correct": correct,
"points_awarded": int(question["points"]) if correct else 0,
"feedback": _FEEDBACK[number],
}
)
return scored
|