Classes:
-
DistributionModel
–Model object for probability distributions
Functions:
-
distrib_from_sampled_quantity
–Extract a distribution from a :SampledQuantity node through :from-distribution path.
-
sample_from_distrib
–Sample from a distribution model based on its type.
DistributionModel
DistributionModel(distrib_id, graph)
Bases: ModelBase
Model object for probability distributions
Attributes:
-
distrib_type
(URIRef
) –the type of distribution to be handled
Parameters:
-
distrib_id
(URIRef
) –URI of the distribution in the graph
-
graph
(Graph
) –RDF graph for loading attributes
Source code in src/rdf_utils/models/distribution.py
51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
distrib_from_sampled_quantity
distrib_from_sampled_quantity(quantity_id, graph)
Extract a distribution from a :SampledQuantity node through :from-distribution path.
Parameters:
-
quantity_id
(URIRef
) –URI of the :SampledQuantity node
-
graph
(Graph
) –RDF graph to look for distribution nodes and attributes
Returns:
-
DistributionModel
–distribution model object
Source code in src/rdf_utils/models/distribution.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
sample_from_distrib
sample_from_distrib(distrib, size=None)
Sample from a distribution model based on its type.
Parameters:
-
distrib
(DistributionModel
) –distribution model
-
size
(Optional[int | tuple[int, ...]]
, default:None
) –Size of the sample, which matches size argument in numpy.random calls. Will be ignored for random rotations at the moment. For uniform and normal distribs, tuple size should have last dimension matching the distrib's dimension.
Returns:
-
Any
–distribution sample with dimension matching given size
Source code in src/rdf_utils/models/distribution.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|