|
| 1 | +from typing import Optional |
| 2 | +import numpy as np |
| 3 | +import pytorch_lightning as pl |
| 4 | +import random |
| 5 | +from ..utils import utils |
| 6 | + |
| 7 | + |
| 8 | +class Sampler(object): |
| 9 | + def _set_seed(self): |
| 10 | + np.random.seed(self.seed) |
| 11 | + pl.seed_everything(self.seed) |
| 12 | + random.seed(self.seed) |
| 13 | + |
| 14 | + def _set_number_target(self, number_target): |
| 15 | + if number_target is None: |
| 16 | + self.number_target = number_target |
| 17 | + return self.number_target |
| 18 | + |
| 19 | + def __init__(self, window_length: int = 10, number_target: Optional[int] = None, seed: Optional[int] = None, degree_agnostic: Boolen) -> None: |
| 20 | + """ |
| 21 | + Parameters |
| 22 | + ---------- |
| 23 | + window_length : int |
| 24 | + Number of nodes to sample in the context window |
| 25 | + number_target : int |
| 26 | + Number of target nodes or edges to sample, can be none because fit can take centers |
| 27 | + seed : int |
| 28 | + Seed for random number generator |
| 29 | + """ |
| 30 | + self.window_length = window_length |
| 31 | + self.number_target = number_target |
| 32 | + self.seed = utils.get_formatted_environ_variable("SEED", int, 42) if seed is None else seed |
| 33 | + self._set_seed() |
| 34 | + |
| 35 | + |
| 36 | + def num_nodes(self, A): |
| 37 | + return A.shape[0] |
| 38 | + |
| 39 | + def num_edges(self, A): |
| 40 | + return A.nnz |
| 41 | + |
| 42 | + def _generate_centers(self, A): |
| 43 | + return np.random.choice(self.num_nodes(A), self.number_target, replace=False) |
| 44 | + def sample(self, centers: Optional[np.ndarray], padding_mask: int = 0) -> np.ndarray: |
| 45 | + raise NotImplementedError |
| 46 | + |
| 47 | + |
| 48 | +""" |
| 49 | +
|
| 50 | +Did: |
| 51 | +1. Reviewed, tested and merged STD team's PR to fix principal failure issue. |
| 52 | +2. Raised PR for funding type and reserve amount in ltd-cdf-pipeline. |
| 53 | +3. Completed Pru backtesting and asked Drew to review. |
| 54 | +4. Oncall deployment duties. |
| 55 | +Will do: |
| 56 | +1. Address any comments on PR for funding type and reserve amount in ltd-cdf-pipeline. |
| 57 | +2. Start testing Prudential on ltd-raw-data-preprocessor. |
| 58 | +
|
| 59 | +Did: |
| 60 | +1. Merged PR for funding type and reserve amount in ltd-cdf-pipeline. |
| 61 | +2. Finished first version of Prudential on ltd-raw-data-preprocessor. |
| 62 | +Will do: |
| 63 | +1. Issue today for other clients due to funding type and reserve amount. Will check in local and then raise PR. |
| 64 | +2. Keep working on Prudential on ltd-raw-data-preprocessor. I am stuck with how to use export date asset. Will reach out to platform oncall |
| 65 | +in case not able to figure it out. |
| 66 | +3. Postpartum meeting for oneamerica oncall issue. Ask questions I had in mind. |
| 67 | +""" |
0 commit comments