Experiments with alt inverse:
Equal probabilities for all items when temperature is equal to 100
This commit is contained in:
@ -155,7 +155,6 @@ def breaker(ctx, codelet):
|
||||
for structure in breakObjects:
|
||||
breakProbability = temperature.getAdjustedProbability(
|
||||
structure.totalStrength / 100.0)
|
||||
#breakProbability = structure.totalStrength / 100.0
|
||||
if random.coinFlip(breakProbability):
|
||||
return
|
||||
for structure in breakObjects:
|
||||
|
||||
@ -68,11 +68,10 @@ class Copycat(object):
|
||||
def run(self, initial, modified, target, iterations):
|
||||
self.workspace.resetWithStrings(initial, modified, target)
|
||||
|
||||
self.temperature.useAdj('original')
|
||||
#self.temperature.useAdj('original')
|
||||
#self.temperature.useAdj('entropy')
|
||||
#self.temperature.useAdj('inverse') # 100 weight
|
||||
#self.temperature.useAdj('150-weight')
|
||||
#self.temperature.useAdj('200-weight')
|
||||
self.temperature.useAdj('inverse') # 100 weight
|
||||
#self.temperature.useAdj('alt_inverse') # 100 weight, equal probs at 100
|
||||
answers = {}
|
||||
for i in range(iterations):
|
||||
answer = self.runTrial()
|
||||
|
||||
@ -24,26 +24,24 @@ def _entropy(temp, prob):
|
||||
return -f * math.log2(f)
|
||||
|
||||
def _inverse_prob(temp, prob):
|
||||
# Temperature, potentially clamped
|
||||
iprob = 1 - prob
|
||||
return (temp / 100) * iprob + ((100 - temp) / 100) * prob
|
||||
|
||||
def _create_weighted_inverse_prob(weight):
|
||||
def _inner_weighted_prob(temp, prob):
|
||||
iprob = 1 - prob
|
||||
return (temp / weight) * iprob + ((weight - temp) / weight) * prob
|
||||
return _inner_weighted_prob
|
||||
def _alt_inverse_prob(temp, prob):
|
||||
if temp == 100:
|
||||
return .5
|
||||
iprob = 1 - prob
|
||||
return (temp / 100) * iprob + ((100 - temp) / 100) * prob
|
||||
|
||||
class Temperature(object):
|
||||
def __init__(self):
|
||||
self.reset()
|
||||
self.adjustmentType = 'inverse'
|
||||
self._adjustmentFormulas = {
|
||||
'original' : _original,
|
||||
'entropy' : _entropy,
|
||||
'inverse' : _inverse_prob,
|
||||
'200-weight' : _create_weighted_inverse_prob(200),
|
||||
'150-weight' : _create_weighted_inverse_prob(150)
|
||||
'original' : _original,
|
||||
'entropy' : _entropy,
|
||||
'inverse' : _inverse_prob,
|
||||
'alt_inverse' : _alt_inverse_prob
|
||||
}
|
||||
|
||||
def reset(self):
|
||||
|
||||
Reference in New Issue
Block a user