<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compute_cardinalities(self):
 """ This will count the number of distinct values for each dimension in the dataset and add that count to the model so that it can be used as a hint by UI components. """

        for dimension in self.model.dimensions:
            result = self.members(dimension.ref, page_size=0)
            dimension.spec['cardinality'] = result.get('total_member_count')