polyvore_outfits.py
def sample_negative(self, outfit_id, item_id, item_type):
        """ Returns a randomly sampled item from a different set
            than the outfit at data_index, but of the same type as
            item_type
        
            data_index: index in self.data where the positive pair
                        of items was pulled from
            item_type: the coarse type of the item that the item
                       that was paired with the anchor
        """
        item_out = item_id
        candidate_sets = self.category2ims[item_type].keys()
        attempts = 0
        while item_out == item_id and attempts < 100:
            choice = np.random.choice(candidate_sets)
            items = self.category2ims[item_type][choice]
            item_index = np.random.choice(range(len(items)))
            item_out = items[item_index]
            attempts += 1
                
        return item_out
 Returns a randomly sampled item from a different set
            than the outfit at data_index, but of the same type as
            item_type
        
            data_index: index in self.data where the positive pair
                        of items was pulled from
            item_type: the coarse type of the item that the item
                       that was paired with the anchor
        
Returns a randomly sampled item from a different set
than the outfit at data_index, but of the same type as
item_type

index in self.data where the positive pair
of items was pulled from
item_type: the coarse type of the item that the item
that was paired with the anchor
Returns a randomly sampled item from a different set than the outfit at data_index but of the same type as item_type index in self . data where the positive pair of items was pulled from item_type : the coarse type of the item that the item that was paired with the anchor
def sample_negative(self, outfit_id, item_id, item_type):
        item_out = item_id
        candidate_sets = self.category2ims[item_type].keys()
        attempts = 0
        while item_out == item_id and attempts < 100:
            choice = np.random.choice(candidate_sets)
            items = self.category2ims[item_type][choice]
            item_index = np.random.choice(range(len(items)))
            item_out = items[item_index]
            attempts += 1
        return item_out
def sample_negative ( self , outfit_id , item_id , item_type ) : item_out = item_id candidate_sets = self . category2ims [ item_type ] . keys ( ) attempts = 0 while item_out == item_id and attempts < 100 : choice = np . random . choice ( candidate_sets ) items = self . category2ims [ item_type ] [ choice ] item_index = np . random . choice ( range ( len ( items ) ) ) item_out = items [ item_index ] attempts += 1 return item_out
Returns a randomly sampled item from a different set
than the outfit at data_index, but of the same type as
item_type
Returns a randomly sampled item from a different set than the outfit at data_index but of the same type as item_type
""" Returns a randomly sampled item from a different set
            than the outfit at data_index, but of the same type as
            item_type
        
            data_index: index in self.data where the positive pair
                        of items was pulled from
            item_type: the coarse type of the item that the item
                       that was paired with the anchor
        """
self
outfit_id
item_id
item_type