0
# Specialized Distributions
1
2
Task-specific distributions for reinforcement learning, clipped distributions, and deterministic distributions for specialized modeling needs.
3
4
## Capabilities
5
6
### Reinforcement Learning Distributions
7
8
#### Epsilon-Greedy Distribution
9
10
Epsilon-greedy distribution for exploration in reinforcement learning.
11
12
```python { .api }
13
class EpsilonGreedy(Distribution):
14
def __init__(self, preferences, epsilon):
15
"""
16
Epsilon-greedy distribution.
17
18
Parameters:
19
- preferences: preference scores for actions (array)
20
- epsilon: exploration probability (float in [0, 1])
21
"""
22
23
@property
24
def preferences(self): ...
25
@property
26
def epsilon(self): ...
27
@property
28
def most_likely_action(self): ...
29
```
30
31
#### Greedy Distribution
32
33
Greedy distribution that always selects the highest-scoring action.
34
35
```python { .api }
36
class Greedy(Distribution):
37
def __init__(self, preferences, dtype=int):
38
"""
39
Greedy distribution.
40
41
Parameters:
42
- preferences: preference scores for actions (array)
43
- dtype: output data type (int or float)
44
"""
45
46
@property
47
def preferences(self): ...
48
@property
49
def most_likely_action(self): ...
50
```
51
52
### Clipped Distributions
53
54
#### Base Clipped Distribution
55
56
Base class for distributions with clipped support.
57
58
```python { .api }
59
class Clipped(Distribution):
60
def __init__(self, distribution, low, high):
61
"""
62
Base clipped distribution.
63
64
Parameters:
65
- distribution: base distribution to clip
66
- low: lower clipping bound (float or array)
67
- high: upper clipping bound (float or array)
68
"""
69
70
@property
71
def distribution(self): ...
72
@property
73
def low(self): ...
74
@property
75
def high(self): ...
76
```
77
78
#### Clipped Normal Distribution
79
80
Normal distribution with clipped support.
81
82
```python { .api }
83
class ClippedNormal(Distribution):
84
def __init__(self, loc, scale, low, high):
85
"""
86
Clipped normal distribution.
87
88
Parameters:
89
- loc: mean parameter (float or array)
90
- scale: standard deviation parameter (float or array, must be positive)
91
- low: lower clipping bound (float or array)
92
- high: upper clipping bound (float or array)
93
"""
94
95
@property
96
def loc(self): ...
97
@property
98
def scale(self): ...
99
@property
100
def low(self): ...
101
@property
102
def high(self): ...
103
```
104
105
#### Clipped Logistic Distribution
106
107
Logistic distribution with clipped support.
108
109
```python { .api }
110
class ClippedLogistic(Distribution):
111
def __init__(self, loc, scale, low, high):
112
"""
113
Clipped logistic distribution.
114
115
Parameters:
116
- loc: location parameter (float or array)
117
- scale: scale parameter (float or array, must be positive)
118
- low: lower clipping bound (float or array)
119
- high: upper clipping bound (float or array)
120
"""
121
122
@property
123
def loc(self): ...
124
@property
125
def scale(self): ...
126
@property
127
def low(self): ...
128
@property
129
def high(self): ...
130
```
131
132
### Deterministic Distribution
133
134
Distribution that always returns the same value.
135
136
```python { .api }
137
class Deterministic(Distribution):
138
def __init__(self, loc):
139
"""
140
Deterministic distribution (Dirac delta).
141
142
Parameters:
143
- loc: deterministic value (float or array)
144
"""
145
146
@property
147
def loc(self): ...
148
@property
149
def event_shape(self): ...
150
```
151
152
### Straight-Through Wrapper
153
154
Wrapper that uses straight-through gradients for samples.
155
156
```python { .api }
157
def straight_through_wrapper(distribution_cls):
158
"""
159
Wraps a distribution to use straight-through gradients for samples.
160
161
Parameters:
162
- distribution_cls: distribution class to wrap
163
164
Returns:
165
Wrapped distribution class with straight-through gradients
166
"""
167
```