Пример #1
0
    def hedonic_value(self, novelty):
        '''Given the agent's desired novelty, how good the novelty value is.

        Not used if *desired_novelty*=-1
        '''
        lmax = gaus_pdf(self.desired_novelty, self.desired_novelty, 4)
        pdf = gaus_pdf(novelty, self.desired_novelty, 4)
        return pdf / lmax
Пример #2
0
 def _make_estimate(self, addr, features):
     vals = np.zeros(self.num_of_features)
     for i in range(self.num_of_features):
         vals[i] = gaus_pdf(features[i], self.centroids[addr][i],
                            self.std) / self.max
     estimate = np.sum(self.sgd_weights[addr] * vals)
     return estimate, vals
Пример #3
0
    def __init__(self,
                 addrs,
                 num_of_features,
                 std,
                 centroid_rate=200,
                 weight_rate=0.2):
        self.centroid_rate = centroid_rate
        self.weight_rate = weight_rate
        self.num_of_features = num_of_features
        self.std = std

        self.sgd_weights = {}
        self.centroids = {}
        for addr in addrs:
            self.sgd_weights[addr] = np.array([0.5] * num_of_features)
            self.centroids[addr] = np.array([0.5] * num_of_features)

        self.max = gaus_pdf(1, 1, std)
Пример #4
0
 def _map_11(self, mean, std, value):
     lmax = gaus_pdf(mean, mean, std)
     pdf = gaus_pdf(value, mean, std)
     return -1.0 + 2 * (pdf / lmax)
Пример #5
0
 def _map1_1(self, mean, std, value):
     lmax = gaus_pdf(mean, mean, std)
     pdf = gaus_pdf(value, mean, std)
     return 1.0 - 2 * (pdf / lmax)
Пример #6
0
 def _map01(self, mean, std, value):
     lmax = gaus_pdf(mean, mean, std)
     pdf = gaus_pdf(value, mean, std)
     return pdf / lmax
Пример #7
0
 def hedonic_value(self, value, desired_value):
     lmax = gaus_pdf(desired_value, desired_value, self.hedonic_std)
     pdf = gaus_pdf(value, desired_value, self.hedonic_std)
     return pdf / lmax