MicrosoftLearning / mslearn-fabric

This repository hosts content related to Microsoft Fabric content on Microsoft Learn.
https://microsoftlearning.github.io/mslearn-fabric/
MIT License
164 stars 128 forks source link

Code issues in the lab 08d-data-science-batch #118

Closed usamabinrauf closed 5 months ago

usamabinrauf commented 6 months ago

Lab: 08d-data-science-batch

Task: Apply the model to generate predictions

Step: 01

Description of issues:

table_name is not initialized in the code snippet which causes error on running the code cell. Moreover, df is passed as a parameter in the line of code df_test = model.transform(df) instead of df_test.

Solution:

  1. Initialize table_name using table_name = "diabetes_test" and add it before the line of code df_test = spark.read.format("delta").load(f"Tables/{table_name}").
  2. Replace df_test = model.transform(df) with df_test = model.transform(df_test).
afelix-95 commented 5 months ago
  1. As long as you ran the previous code snippet first and created the delta table, the variable table_name can still be used in the next code snippet without being declared again.
  2. df in df_test = model.transform(df) is actually referring to the type of input (DataFrame) applied to the transform method of the MLFlowTransformer and not to the object df_test directly.

So, running the code snippets as they are in the exercise should produce the desired output without errors.