MLEP Course2 Week1 Assignment Modify Domain Error

I am not sure how to solve the error in ex. 8:

There was a problem grading your submission. Details:
‘NoneType’ object has no attribute ‘DESCRIPTOR’

My last parameter in the modify_domain_of_features() function call is just the string ‘metformin’. Am I not specifying it correctly?

Please click my name and message your notebook as an attachment.

According to the starter code, you should return schema

def modify_domain_of_features(features_list, schema, to_domain_name):
    # some code
    return schema

The caller in the cell following the code above also captures the updated schema:
schema = modify_domain_of_features(...)

Your code doesn’t schema from the function and hence the grader error.

Please keep 2 things in mind:

  1. Don’t modify code in places you aren’t supposed to.
  2. Don’t add / remove cells / print statements.

Hi Balaji,

Thank you for your response. Shouldn’t set_domain() return None as it updates the input schema?


This is not about the return value of set_domain. Once the domain is set, the updated schema should be returned from modify_domain_of_features.

I see your point.

My understanding is that modify_domain_of_features() is only a wrapper function, the acting function is set_domain(). Does set_domain() itself return anything? If I omit the assignment for modify_domain_of_features() function call, would the code still work as intended (regardless of the grading error)?

Please use the help builtin to view the return type of the function. The set_domain function returns nothing.

>>> import tensorflow_data_validation as tfdv
>>> help(tfdv.set_domain)

Help on function set_domain in module tensorflow_data_validation.utils.schema_util:

set_domain(schema: tensorflow_metadata.proto.v0.schema_pb2.Schema, feature_path: tensorflow_data_validation.types.FeaturePath, domain: Any) -> None

You should return the updated schema, as you pointed out.

That’s what I tried to point out/confirm with you: the return of schema is not needed as it’s been silently updated by set_domain, although the setup of this assignment requires it.


Can you confirm my thought in the last message? It’s just for my understanding of tensor flow functions. I am new to tf. Thank you! I

Your understanding is correct. Although you’ve updated the schema in-place, it’s important to return the schema for the grader to pass the check.

1 Like