예제 #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
파일: mappers.py 프로젝트: assamite/creamas
 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
파일: mappers.py 프로젝트: assamite/creamas
 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
파일: mappers.py 프로젝트: assamite/creamas
 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