Issue with Course 1 Week 2 C1_W2_Assignment

Can anyone help me out with this? Thank you

1 Like

It has been more than 2 weeks since I posted this. How long does it take for the community guides to get back with anything? This 40$/month Coursera plan for this course is a waste of money if it takes 3 weeks for just one doubt to get solved, as I cannot proceed with the rest of the course without understanding this.

2 Likes

Can you please print out the content of data_config_unbalanced and bias_config_unbalanced variables? The issue stems from being unable to deserialise an object to JSON but not clear which object this refers to.

Additionally you can try and deserialise each object to json manually and see if you get any errors, e.g.

import json
print(json.dumps(<variablename>, indent=4))

Hi. Have you managed to solve it? I’ve noticed the same problem.

Set up:

from sagemaker import clarify

bias_report_unbalanced_output_path = ‘s3://{}/bias/generated_bias_report/unbalanced’.format(bucket)

data_config_unbalanced = clarify.DataConfig(
### BEGIN SOLUTION - DO NOT delete this comment for grading purposes
s3_data_input_path=data_s3_uri_unbalanced, # Replace None
s3_output_path=bias_report_unbalanced_output_path, # Replace None
label=“sentiment”, # Replace None
### END SOLUTION - DO NOT delete this comment for grading purposes
headers=df.columns.to_list(),
dataset_type=‘text/csv’
)

clarify_processor_unbalanced.run_pre_training_bias(
### BEGIN SOLUTION - DO NOT delete this comment for grading purposes
data_config=data_config_unbalanced, # Replace None
data_bias_config=bias_config_unbalanced, # Replace None
### END SOLUTION - DO NOT delete this comment for grading purposes
methods=[“CI”, “DPL”, “KL”, “JS”, “LP”, “TVD”, “KS”],
wait=False,
logs=False
)

Output:
Job Name: Clarify-Pretraining-Bias-2022-04-04-20-04-08-291
Inputs: [{‘InputName’: ‘dataset’, ‘AppManaged’: False, ‘S3Input’: {‘S3Uri’: ‘s3://sagemaker-us-east-1-018025132320/bias/unbalanced/womens_clothing_ecommerce_reviews_transformed.csv’, ‘LocalPath’: ‘/opt/ml/processing/input/data’, ‘S3DataType’: ‘S3Prefix’, ‘S3InputMode’: ‘File’, ‘S3DataDistributionType’: ‘FullyReplicated’, ‘S3CompressionType’: ‘None’}}, {‘InputName’: ‘analysis_config’, ‘AppManaged’: False, ‘S3Input’: {‘S3Uri’: ‘s3://sagemaker-us-east-1-018025132320/bias/generated_bias_report/unbalanced/analysis_config.json’, ‘LocalPath’: ‘/opt/ml/processing/input/config’, ‘S3DataType’: ‘S3Prefix’, ‘S3InputMode’: ‘File’, ‘S3DataDistributionType’: ‘FullyReplicated’, ‘S3CompressionType’: ‘None’}}]
Outputs: [{‘OutputName’: ‘analysis_result’, ‘AppManaged’: False, ‘S3Output’: {‘S3Uri’: ‘s3://sagemaker-us-east-1-018025132320/bias/generated_bias_report/unbalanced’, ‘LocalPath’: ‘/opt/ml/processing/output’, ‘S3UploadMode’: ‘EndOfJob’}}]