MCPcopy Create free account
hub / github.com/FinancialComputingUCL/LOBFrame / detect_changing_points

Function detect_changing_points

utils.py:343–361  ·  view source on GitHub ↗

Detect the last index of the file containing the target value. Args: target (int): Target index. cumulative_lengths (list): List of cumulative lengths. Returns: 0 if the target value is in the first file, the last index of the file containing the target value ot

(
    target: int, cumulative_lengths: list[int]
)

Source from the content-addressed store, hash-verified

341
342
343def detect_changing_points(
344 target: int, cumulative_lengths: list[int]
345) -> Union[int, None]:
346 """
347 Detect the last index of the file containing the target value.
348 Args:
349 target (int): Target index.
350 cumulative_lengths (list): List of cumulative lengths.
351
352 Returns:
353 0 if the target value is in the first file, the last index of the file containing the target value otherwise.
354 """
355 for i, length in enumerate(cumulative_lengths):
356 if target <= length:
357 if i == 0:
358 return 0
359 else:
360 return cumulative_lengths[i - 1]
361 return None
362
363
364def wandb_hyperparameters_saving(

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected