0
0
ML Pythonprogramming~10 mins

ML vs traditional programming in ML Python - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
A'learn model'
B'go outside'
C'train data'
D'predict output'
Attempts:
3 left
2fill in blank
medium

Complete 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'
Atrain_model
Brule_engine
Cfixed_rules
Dmanual_code
Attempts:
3 left
3fill in blank
hard

Fix 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'
Afit
Blearn
Ctrain
Dpredict
Attempts:
3 left
4fill in blank
hard

Fill 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'
A>
B<
C==
D!=
Attempts:
3 left
5fill in blank
hard

Fill 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'
Akey
Bvalue
C>
D<
Attempts:
3 left