(self, env, dataset, domain_df, active_attrs)
:param dataset: (Dataset) original dataset
        :param domain_df: (DataFrame) currently populated domain dataframe.
            Required columns are: _vid_, _tid_, attribute, domain, domain_size, init_value
        :param active_attrs: (list[str]) attributes that have random values
:param dataset: (Dataset) original dataset
        :param domain_df: (DataFrame) currently populated domain dataframe.
            Required columns are: _vid_, _tid_, attribute, domain, domain_size, init_value
        :param active_attrs: (list[str]) attributes that have random values
: param dataset : ( Dataset ) original dataset : param domain_df : ( DataFrame ) currently populated domain dataframe . Required columns are : _vid_ _tid_ attribute domain domain_size init_value : param active_attrs : ( list [ str ] ) attributes that have random values
def __init__(self, env, dataset, domain_df, active_attrs):
        """
        :param dataset: (Dataset) original dataset
        :param domain_df: (DataFrame) currently populated domain dataframe.
            Required columns are: _vid_, _tid_, attribute, domain, domain_size, init_value
        :param active_attrs: (list[str]) attributes that have random values
        """
        torch.nn.Module.__init__(self)
        Estimator.__init__(self, env, dataset)

        self.active_attrs = active_attrs

        # Sorted records of the currently populated domain. This helps us
        # align the final predicted probabilities.
        self.domain_records = domain_df.sort_values('_vid_')[['_vid_', '_tid_', 'attribute', 'domain', 'init_value']].to_records()

        # self.dom maps tid --> attr --> list of domain values
        # we need to find the number of domain values we will be generating
        # a training sample for.
        self.n_samples = int(domain_df['domain_size'].sum())

        # Create and initialize featurizers.
        self.featurizers = [CooccurAttrFeaturizer(self.ds)]
        for f in self.featurizers:
            f.setup()
        self.num_features = sum(feat.num_features() for feat in self.featurizers)

        # Construct the X and Y tensors.
        self._gen_training_data()

        # Use pytorch logistic regression model.
        self._W = torch.nn.Parameter(torch.zeros(self.num_features, 1))
        torch.nn.init.xavier_uniform_(self._W)
        self._B = torch.nn.Parameter(torch.Tensor([1e-6]))

        self._loss = torch.nn.BCELoss()
        if self.env['optimizer'] == 'sgd':
            self._optimizer = SGD(self.parameters(), lr=self.env['learning_rate'], momentum=self.env['momentum'],
                                  weight_decay=self.WEIGHT_DECAY)
        else:
            self._optimizer = Adam(self.parameters(), lr=self.env['learning_rate'], weight_decay=self.WEIGHT_DECAY)
def __init__ ( self , env , dataset , domain_df , active_attrs ) : torch . nn . Module . __init__ ( self ) Estimator . __init__ ( self , env , dataset ) self . active_attrs = active_attrs # Sorted records of the currently populated domain. This helps us # align the final predicted probabilities. self . domain_records = domain_df . sort_values ( '_vid_' ) [ [ '_vid_' , '_tid_' , 'attribute' , 'domain' , 'init_value' ] ] . to_records ( ) # self.dom maps tid --> attr --> list of domain values # we need to find the number of domain values we will be generating # a training sample for. self . n_samples = int ( domain_df [ 'domain_size' ] . sum ( ) ) # Create and initialize featurizers. self . featurizers = [ CooccurAttrFeaturizer ( self . ds ) ] for f in self . featurizers : f . setup ( ) self . num_features = sum ( feat . num_features ( ) for feat in self . featurizers ) # Construct the X and Y tensors. self . _gen_training_data ( ) # Use pytorch logistic regression model. self . _W = torch . nn . Parameter ( torch . zeros ( self . num_features , 1 ) ) torch . nn . init . xavier_uniform_ ( self . _W ) self . _B = torch . nn . Parameter ( torch . Tensor ( [ 1e-6 ] ) ) self . _loss = torch . nn . BCELoss ( ) if self . env [ 'optimizer' ] == 'sgd' : self . _optimizer = SGD ( self . parameters ( ) , lr = self . env [ 'learning_rate' ] , momentum = self . env [ 'momentum' ] , weight_decay = self . WEIGHT_DECAY ) else : self . _optimizer = Adam ( self . parameters ( ) , lr = self . env [ 'learning_rate' ] , weight_decay = self . WEIGHT_DECAY )