Data Validation C2W1 Exercise 8_Assignment

Hi
Can someone help? I keep getting schema type error when I run Exercise 8 Data Validation of C2W1 Assignment. The code does not require filling in any ‘None’ item.

schema is referred to as list in the error but should be Schema proto. This is not allowing me to submit the assignment.

I am not just sure what is going on or whether I am missing something

Hope to hear back soon.

Thanks

Tunde

Hi @tundeak
can you share with us the the error output?
Anyway I suppose you are working to the function named ‘modify_domain_of_features’. If this is the case please refer to the hint shown inside the function:

‘HINT: Loop over the feature list and use set_domain with the inferred schema, feature name and target domain name’

Please let me know if my assumption is correct.
Hope this can help
BR

Hello Sir,
I am trying the following code but its not working
def modify_domain_of_features(features_list, schema, to_domain_name):
‘’’
Modify a list of features’ domains.

        Parameters:
                features_list : Features that need to be modified
                schema: Inferred schema
                to_domain_name : Target domain to be transferred to the features list

        Returns:
                schema: new schema
'''
### START CODE HERE
# HINT: Loop over the feature list and use set_domain with the inferred schema, feature name and target domain name
for feature in features_list:
    schema = tfdv.set_domain(schema,feature,to_domain_name)
### END CODE HERE
return schema

Can you please help me out

Hi @gangradeamitesh
How did you call this function? Maybe that some of the input parameters are wrong.
Please share the returned error traces
BR

tfdv.set_domain function return None type and updates the schema in_place. Try
tfdv.set_domain(schema,feature,to_domain_name) without any assignment.

Best,
K.

1 Like