Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to show how traditional programming uses rules to get output.
ML Python
def traditional_programming(input_data): # Use rules to get output if input_data == 'sunny': return [1] else: return 'unknown'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to show how machine learning uses data to learn a model.
ML Python
def machine_learning(data): # Learn a model from data model = [1](data) return model
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the code that predicts output using a learned model.
ML Python
def predict(model, input_data): # Predict output using model output = model.[1](input_data) return output
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary comprehension that shows ML learns from data length and compares it.
ML Python
results = {item: len(item) [1] 3 for item in data if len(item) [2] 2}
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a dictionary comprehension that filters and transforms data based on value comparisons.
ML Python
filtered = [1]: [2] for [1], [2] in dataset.items() if [2] [3] 10}
Drag options to blanks, or click blank then click option'
Attempts:
3 left