Updates paper draft for final chi2 table
This commit is contained in:
28
papers/resources/adj.l
Normal file
28
papers/resources/adj.l
Normal file
@ -0,0 +1,28 @@
|
||||
(defun get-temperature-adjusted-probability (prob &aux low-prob-factor
|
||||
result)
|
||||
; This function is a filter: it inputs a value (from 0 to 100) and returns
|
||||
; a probability (from 0 - 1) based on that value and the temperature. When
|
||||
; the temperature is 0, the result is (/ value 100), but at higher
|
||||
; temperatures, values below 50 get raised and values above 50 get lowered
|
||||
; as a function of temperature.
|
||||
; I think this whole formula could probably be simplified.
|
||||
|
||||
(setq result
|
||||
(cond ((= prob 0) 0)
|
||||
((<= prob .5)
|
||||
(setq low-prob-factor (max 1 (truncate (abs (log prob 10)))))
|
||||
(min (+ prob
|
||||
(* (/ (- 10 (sqrt (fake-reciprocal *temperature*)))
|
||||
100)
|
||||
(- (expt 10 (- (1- low-prob-factor))) prob)))
|
||||
.5))
|
||||
|
||||
((= prob .5) .5)
|
||||
((> prob .5)
|
||||
(max (- 1
|
||||
(+ (- 1 prob)
|
||||
(* (/ (- 10 (sqrt (fake-reciprocal *temperature*)))
|
||||
100)
|
||||
(- 1 (- 1 prob)))))
|
||||
.5))))
|
||||
result)
|
||||
21
papers/resources/best.py
Normal file
21
papers/resources/best.py
Normal file
@ -0,0 +1,21 @@
|
||||
def _working_best(temp, prob):
|
||||
s = .5 # convergence
|
||||
r = 1.05 # power
|
||||
u = prob ** r if prob < .5 else prob ** (1/r)
|
||||
return _weighted(temp, prob, s, u)
|
||||
|
||||
def _soft_best(temp, prob):
|
||||
s = .5 # convergence
|
||||
r = 1.05 # power
|
||||
u = prob ** r if prob < .5 else prob ** (1/r)
|
||||
return _weighted(temp, prob, s, u)
|
||||
|
||||
def _parameterized_best(temp, prob):
|
||||
alpha = 5
|
||||
beta = 1
|
||||
s = .5
|
||||
s = (alpha * prob + beta * s) / (alpha + beta)
|
||||
r = 1.05
|
||||
u = prob ** r if prob < .5 else prob ** (1/r)
|
||||
return _weighted(temp, prob, s, u)
|
||||
|
||||
12
papers/resources/entropy.py
Normal file
12
papers/resources/entropy.py
Normal file
@ -0,0 +1,12 @@
|
||||
import math
|
||||
|
||||
def _entropy(temp, prob):
|
||||
if prob == 0 or prob == 0.5 or temp == 0:
|
||||
return prob
|
||||
if prob < 0.5:
|
||||
return 1.0 - _original(temp, 1.0 - prob)
|
||||
coldness = 100.0 - temp
|
||||
a = math.sqrt(coldness)
|
||||
c = (10 - a) / 100
|
||||
f = (c + 1) * prob
|
||||
return -f * math.log2(f)
|
||||
BIN
papers/resources/final.pdf
Normal file
BIN
papers/resources/final.pdf
Normal file
Binary file not shown.
12
papers/resources/original.py
Normal file
12
papers/resources/original.py
Normal file
@ -0,0 +1,12 @@
|
||||
import math
|
||||
|
||||
def _original(temp, prob):
|
||||
if prob == 0 or prob == 0.5 or temp == 0:
|
||||
return prob
|
||||
if prob < 0.5:
|
||||
return 1.0 - _original(temp, 1.0 - prob)
|
||||
coldness = 100.0 - temp
|
||||
a = math.sqrt(coldness)
|
||||
c = (10 - a) / 100
|
||||
f = (c + 1) * prob
|
||||
return max(f, 0.5)
|
||||
28
papers/resources/weighted.py
Normal file
28
papers/resources/weighted.py
Normal file
@ -0,0 +1,28 @@
|
||||
def _weighted(temp, prob, s, u):
|
||||
weighted = (temp / 100) * s + ((100 - temp) / 100) * u
|
||||
return weighted
|
||||
|
||||
def _weighted_inverse(temp, prob):
|
||||
iprob = 1 - prob
|
||||
return _weighted(temp, prob, iprob, prob)
|
||||
|
||||
# Uses .5 instead of 1-prob
|
||||
def _fifty_converge(temp, prob):
|
||||
return _weighted(temp, prob, .5, prob)
|
||||
|
||||
# Curves to the average of the (1-p) and .5
|
||||
def _soft_curve(temp, prob):
|
||||
return min(1, _weighted(temp, prob, (1.5-prob)/2, prob))
|
||||
|
||||
# Curves to the weighted average of the (1-p) and .5
|
||||
def _weighted_soft_curve(temp, prob):
|
||||
weight = 100
|
||||
gamma = .5 # convergance value
|
||||
alpha = 1 # gamma weight
|
||||
beta = 3 # iprob weight
|
||||
curved = min(1,
|
||||
(temp / weight) *
|
||||
((alpha * gamma + beta * (1 - prob)) /
|
||||
(alpha + beta)) +
|
||||
((weight - temp) / weight) * prob)
|
||||
return curved
|
||||
Reference in New Issue
Block a user