oracle#
Oracle functions for testing model
- perceptivo.psychophys.oracle.piecewise_probabilistic(points: numpy.ndarray, scale: float = 5) callable #
Make a piecewise function along a series of (frequency, amplitude) points with some gaussian error
- Parameters
points (np.ndarray) – n x 2 array of x/y (frequency, amplitude) coordinates that make up an audiogram
scale (float) – Scale parameter of noise in amplitude domain to get answers “wrong”
Returns:
- perceptivo.psychophys.oracle.reference_audiogram(scale: float = 2) callable #
Generate fake audiometry samples using median threshold values obtained from the NHANES dataset: https://wwwn.cdc.gov/Nchs/Nhanes/2015-2016/AUX_I.htm
The median rates make a piecewise linear function:
Frequency
Threshold
500
10
1000
10
2000
10
3000
10
4000
15
6000
20
8000
20
- Parameters
scale (float) – amount of randomness to multiply the noise of the pseudo-response threshold by
- Returns
callable made by
piecewise_probabilistic()
that works as an oracle function- Parameters
scale ()
- Returns
A numpy piecewise function that returns Sample objects for a given input frequency and amplitude
- perceptivo.psychophys.oracle.generate_samples(n_samples: int, scale: float = 2, freqs=None, amplitudes=None, randomize=False, freq_range=(500, 8000), amplitude_range=(0, 50), oracle: Optional[callable] = None) perceptivo.types.psychophys.Samples #
Generate fake audiometry samples using median threshold values obtained from the NHANES dataset: https://wwwn.cdc.gov/Nchs/Nhanes/2015-2016/AUX_I.htm
The median rates make a piecewise linear function:
Frequency
Threshold
500
10
1000
10
2000
10
3000
10
4000
15
6000
20
8000
20
Examples
from perceptivo.psychophys.oracle import generate_samples samples = generate_samples(n_samples=1000, scale=10) samples.plot()
- Parameters
n_samples (int) – number of samples to generate
scale (float) – amount of randomness to multiply the noise of the pseudo-response threshold by
freqs (arraylike) – (Optional) - predetermined array of frequencies (of length n_samples) to test
amplitudes (arraylike) – (Optional) - predetermined array of amplitudes (of length n_samples) to test
randomize (bool) – Randomize order of samples before returning, (default
False
)
- Returns