@@ -111,27 +111,28 @@ class IndependentCascadeModel(DiffusionModel):
111111 payoffs : t .Optional [array .array ] = None ,
112112 _edge_probabilities : t .Optional [array .array ] = None ,
113113 ) -> None : ...
114- def compute_marginal_gain (
115- self , seed_set : t .Iterable [int ], new_seed : t .Optional [int ], num_trials : int
116- ) -> float :
114+ def compute_marginal_gains (
115+ self , seed_set : t .Iterable [int ], new_seeds : t .List [int ], num_trials : int
116+ ) -> t . List [ float ] :
117117 """
118- Computes the marginal gain of adding new_seed on top of seed_set. Averages over the given number
119- of trials. If new_seed is None, just gives the average influence of the seed set. Computes
120- marginal gain using payoffs if set.
118+ Computes the marginal gain of adding each seed in new_seeds on top of the original seed_set.
119+ Averages over num_trials number of randomized activations.
121120
122121 Parameters
123122 ----------
124123 seed_set : Iterable[int]
125124 An iterable representing the current seed set. Can be empty.
126- new_seed : int
127- New seed set to compute marginal gain on.
125+ new_seeds : List[ int]
126+ New seeds to compute marginal gains on. Can be empty .
128127 num_trials : int
129128 Number of randomized trials to run.
130129
131130 Returns
132131 ----------
133- float
134- Average marginal gain in profit over all trials.
132+ List[float]
133+ List containing computed marginal gains. First entry is average influence of the
134+ starting seed set. Following entries are marginal gains with the addition of vertices
135+ from new_seeds in order. Has length len(new_seeds)+1.
135136 """
136137
137138class LinearThresholdModel (DiffusionModel ):
@@ -171,30 +172,31 @@ class LinearThresholdModel(DiffusionModel):
171172 """
172173 ...
173174
174- def compute_marginal_gain (
175+ def compute_marginal_gains (
175176 self ,
176177 seed_set : t .Iterable [int ],
177- new_seed : t .Optional [int ],
178+ new_seeds : t .List [int ],
178179 num_trials : int ,
179180 * ,
180181 _node_thresholds : t .Optional [array .array ] = None ,
181- ) -> float :
182+ ) -> t . List [ float ] :
182183 """
183- Computes the marginal gain of adding new_seed on top of seed_set. Averages over the given number
184- of trials. If new_seed is None, just gives the average influence of the seed set. Computes
185- marginal gain using payoffs if set.
184+ Computes the marginal gain of adding each seed in new_seeds on top of the original seed_set.
185+ Averages over num_trials number of randomized activations.
186186
187187 Parameters
188188 ----------
189189 seed_set : Iterable[int]
190190 An iterable representing the current seed set. Can be empty.
191- new_seed : int
192- New seed set to compute marginal gain on.
191+ new_seeds : List[ int]
192+ New seeds to compute marginal gains on. Can be empty .
193193 num_trials : int
194194 Number of randomized trials to run.
195195
196196 Returns
197197 ----------
198- float
199- Average marginal gain in profit over all trials.
198+ List[float]
199+ List containing computed marginal gains. First entry is average influence of the
200+ starting seed set. Following entries are marginal gains with the addition of vertices
201+ from new_seeds in order. Has length len(new_seeds)+1.
200202 """
0 commit comments