hw2/hw2_submission.py
def gen_by_class(self):
        """
        With the given input dataset (self.x, self.y), generate 3 dictionaries to calculate class-wise mean and variance of the data.
        - self.x_by_class : A dictionary of numpy arraies with the keys as each class label and values as data with such label.
        - self.mean_by_class : A dictionary of numpy arraies with the keys as each class label and values as mean of the data with such label.
        - self.std_by_class : A dictionary of numpy arraies with the keys as each class label and values as standard deviation of the data with such label.
        - self.y_prior : A numpy array of shape (C,) containing prior probability of each class
        """
        self.x_by_class = dict()
        self.mean_by_class = dict()
        self.std_by_class = dict()
        self.y_prior = None

        ############################################################
        ############################################################
        # BEGIN_YOUR_CODE
        # Generate dictionaries.
        # hint : to see all unique y labels, you might use np.unique function, e.g., np.unique(self.y)

        pass

        # END_YOUR_CODE
        ############################################################
        ############################################################        

        With the given input dataset (self.x, self.y), generate 3 dictionaries to calculate class-wise mean and variance of the data.
        - self.x_by_class : A dictionary of numpy arraies with the keys as each class label and values as data with such label.
        - self.mean_by_class : A dictionary of numpy arraies with the keys as each class label and values as mean of the data with such label.
        - self.std_by_class : A dictionary of numpy arraies with the keys as each class label and values as standard deviation of the data with such label.
        - self.y_prior : A numpy array of shape (C,) containing prior probability of each class
        
With the given input dataset (self.x, self.y), generate 3 dictionaries to calculate class-wise mean and variance of the data.
self.x_by_class : A dictionary of numpy arraies with the keys as each class label and values as data with such label.
self.mean_by_class : A dictionary of numpy arraies with the keys as each class label and values as mean of the data with such label.
self.std_by_class : A dictionary of numpy arraies with the keys as each class label and values as standard deviation of the data with such label.
self.y_prior : A numpy array of shape (C,) containing prior probability of each class
With the given input dataset ( self . x self . y ) generate 3 dictionaries to calculate class - wise mean and variance of the data . self . x_by_class : A dictionary of numpy arraies with the keys as each class label and values as data with such label . self . mean_by_class : A dictionary of numpy arraies with the keys as each class label and values as mean of the data with such label . self . std_by_class : A dictionary of numpy arraies with the keys as each class label and values as standard deviation of the data with such label . self . y_prior : A numpy array of shape ( C ) containing prior probability of each class
def gen_by_class(self):
        self.x_by_class = dict()
        self.mean_by_class = dict()
        self.std_by_class = dict()
        self.y_prior = None
        pass
def gen_by_class ( self ) : self . x_by_class = dict ( ) self . mean_by_class = dict ( ) self . std_by_class = dict ( ) self . y_prior = None pass
With the given input dataset (self.x, self.y), generate 3 dictionaries to calculate class-wise mean and variance of the data.
With the given input dataset ( self . x self . y ) generate 3 dictionaries to calculate class - wise mean and variance of the data .
"""
        With the given input dataset (self.x, self.y), generate 3 dictionaries to calculate class-wise mean and variance of the data.
        - self.x_by_class : A dictionary of numpy arraies with the keys as each class label and values as data with such label.
        - self.mean_by_class : A dictionary of numpy arraies with the keys as each class label and values as mean of the data with such label.
        - self.std_by_class : A dictionary of numpy arraies with the keys as each class label and values as standard deviation of the data with such label.
        - self.y_prior : A numpy array of shape (C,) containing prior probability of each class
        """ ############################################################ ############################################################ # BEGIN_YOUR_CODE # Generate dictionaries. # hint : to see all unique y labels, you might use np.unique function, e.g., np.unique(self.y) # END_YOUR_CODE ############################################################ ############################################################        
self