MCPcopy Index your code
hub / github.com/dask/dask / RandomChoice

Class RandomChoice

dask/array/_array_expr/random.py:993–1027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

991
992
993class RandomChoice(IO):
994 _parameters = [
995 "array",
996 "chunks",
997 "_meta",
998 "_state",
999 "replace",
1000 "p",
1001 "axis",
1002 "shuffle",
1003 ]
1004 _defaults = {"axis": None, "shuffle": None}
1005 _funcname = "da.random.choice-"
1006
1007 @cached_property
1008 def chunks(self):
1009 return self.operand("chunks")
1010
1011 @cached_property
1012 def sizes(self):
1013 return list(product(*self.chunks))
1014
1015 @cached_property
1016 def state_data(self):
1017 return random_state_data(len(self.sizes), self._state)
1018
1019 @cached_property
1020 def _meta(self):
1021 return self.operands("_meta")
1022
1023 def _layer(self) -> dict:
1024 return {
1025 k: (_choice_rs, state, self.array, size, self.replace, self.p)
1026 for k, state, size in zip(self.__dask_keys__(), self.state_data, self.sizes)
1027 }
1028
1029
1030class RandomChoiceGenerator(RandomChoice):

Callers 1

choiceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…