mirror of
https://github.com/maciej-bendkowski/generic-boltzmann-brain.git
synced 2024-08-17 08:30:30 +03:00
Rename rejectionSampler' to toleranceRejectionSampler
This commit is contained in:
parent
febfcce6c3
commit
882b55f40b
@ -8,7 +8,7 @@
|
||||
module Data.Boltzmann.Sampler (
|
||||
BoltzmannSampler (..),
|
||||
rejectionSampler,
|
||||
rejectionSampler',
|
||||
toleranceRejectionSampler,
|
||||
hoistBoltzmannSampler,
|
||||
) where
|
||||
|
||||
@ -35,9 +35,9 @@ rejectionSampler lb ub = do
|
||||
Nothing -> rejectionSampler lb ub
|
||||
)
|
||||
|
||||
rejectionSampler' ::
|
||||
toleranceRejectionSampler ::
|
||||
(RandomGen g, BoltzmannSampler a) => Int -> Double -> BitOracle g a
|
||||
rejectionSampler' n eps = rejectionSampler lb ub
|
||||
toleranceRejectionSampler n eps = rejectionSampler lb ub
|
||||
where
|
||||
lb = floor $ (1 - eps) * fromIntegral n
|
||||
ub = ceiling $ (1 + eps) * fromIntegral n
|
||||
|
@ -11,7 +11,7 @@ import Data.Boltzmann (
|
||||
evalIO,
|
||||
mkBoltzmannSampler,
|
||||
mkDefWeights,
|
||||
rejectionSampler',
|
||||
toleranceRejectionSampler,
|
||||
)
|
||||
import Data.Default (Default (def))
|
||||
|
||||
@ -34,4 +34,4 @@ mkBoltzmannSampler
|
||||
|
||||
randomBinTreeListIO :: Int -> IO [BinTree]
|
||||
randomBinTreeListIO n =
|
||||
evalIO $ replicateM n (rejectionSampler' @SMGen 1000 0.2)
|
||||
evalIO $ replicateM n (toleranceRejectionSampler @SMGen 1000 0.2)
|
||||
|
@ -11,7 +11,7 @@ import Data.Boltzmann (
|
||||
evalIO,
|
||||
mkBoltzmannSampler,
|
||||
mkDefWeights,
|
||||
rejectionSampler',
|
||||
toleranceRejectionSampler,
|
||||
)
|
||||
import Data.Default (Default (def))
|
||||
|
||||
@ -57,4 +57,4 @@ mkBoltzmannSampler
|
||||
randomLambdaListIO :: Int -> IO [BinLambda]
|
||||
randomLambdaListIO n =
|
||||
evalIO $
|
||||
replicateM n (rejectionSampler' @SMGen 10_000 0.2)
|
||||
replicateM n (toleranceRejectionSampler @SMGen 10_000 0.2)
|
||||
|
@ -8,7 +8,7 @@ import Data.Boltzmann (
|
||||
BoltzmannSampler (..),
|
||||
evalIO,
|
||||
mkDefBoltzmannSampler,
|
||||
rejectionSampler',
|
||||
toleranceRejectionSampler,
|
||||
)
|
||||
|
||||
import System.Random.SplitMix (SMGen)
|
||||
@ -20,7 +20,7 @@ mkDefBoltzmannSampler ''Tree 100
|
||||
|
||||
randomTreeListIO :: Int -> IO [Tree]
|
||||
randomTreeListIO n =
|
||||
evalIO $ replicateM n (rejectionSampler' @SMGen 1000 0.2)
|
||||
evalIO $ replicateM n (toleranceRejectionSampler @SMGen 1000 0.2)
|
||||
|
||||
newtype Tree' = MkTree' Tree
|
||||
deriving (Show)
|
||||
|
@ -7,7 +7,7 @@ module Data.Boltzmann (
|
||||
mkDefBoltzmannSampler,
|
||||
BoltzmannSampler (..),
|
||||
rejectionSampler,
|
||||
rejectionSampler',
|
||||
toleranceRejectionSampler,
|
||||
mkDefWeights,
|
||||
BitOracle,
|
||||
EvalIO (..),
|
||||
@ -29,7 +29,7 @@ import Data.Boltzmann.System.TH (
|
||||
import Data.Boltzmann.Sampler (
|
||||
BoltzmannSampler (..),
|
||||
rejectionSampler,
|
||||
rejectionSampler',
|
||||
toleranceRejectionSampler,
|
||||
)
|
||||
|
||||
import Data.Boltzmann.Sampler.TH (
|
||||
|
Loading…
Reference in New Issue
Block a user