Signal API¶
MultiFrequencySignal¶
mfdro.signal.MultiFrequencySignal(config: SignalConfig | None = None)
¶
Estimate a reproducible geometric disagreement signal.
Create an estimator from a validated scientific configuration.
Source code in src/mfdro/signal.py
422 423 424 425 426 427 | |
estimate(measures: Mapping[str, object], *, seed: int | None = None, include_support: bool = False) -> SignalEstimate
¶
Estimate one aligned collection of empirical measures.
DataFrames are aligned by asset label; unlabelled arrays must already
share column order. seed controls projected directions, while
include_support returns a defensive copy of a free-support center.
Source code in src/mfdro/signal.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
validate_path_inputs(daily_returns: pd.DataFrame, *, lookback_months: int, formation_dates: Sequence[object] | None = None, memberships: Mapping[object, Sequence[object]] | None = None, reference_calendar: Sequence[object] | None = None, seed_namespace: str = 'signal') -> PathDiagnostics
¶
Inspect every requested window without computing transport geometry.
Hard contract violations still raise :class:DataContractError.
Ordinary warm-up, calendar, and frequency-sample insufficiencies are
returned as diagnostic rows so users can inspect the complete schedule.
Source code in src/mfdro/signal.py
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | |
estimate_path(daily_returns: pd.DataFrame, *, lookback_months: int, formation_dates: Sequence[object] | None = None, memberships: Mapping[object, Sequence[object]] | None = None, reference_calendar: Sequence[object] | None = None, on_insufficient: Literal['skip', 'raise'] = 'skip', seed_namespace: str = 'signal', progress_callback: ProgressCallback | None = None) -> SignalPath
¶
Estimate a monthly point-in-time signal path from a daily panel.
progress_callback receives one immutable :class:PathProgress
notification after every estimated or skipped formation. No progress
dependency or terminal output is imposed by the package.
Source code in src/mfdro/signal.py
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | |
SignalEstimate¶
mfdro.signal.SignalEstimate(rho: float, sqrt_rho: float, seed: int, config_digest: str, frequencies: tuple[str, ...], frequency_weights: tuple[float, ...], barycenter_weights: tuple[float, ...], sample_sizes: tuple[int, ...], n_assets: int, asset_labels: tuple[object, ...] | None, support: FloatArray | None = None, frequency_squared_distances: tuple[float, ...] = ())
dataclass
¶
Auditable result of one multi-frequency signal estimate.
rho is the configured squared dispersion and sqrt_rho its square
root. frequency_squared_distances retains the unweighted distance from
each frequency to the configured center. The remaining fields identify the
numerical experiment. support is returned only when requested for a
free-support estimate.
to_record() -> dict[str, object]
¶
Flatten the estimate into a machine-readable record.
Source code in src/mfdro/signal.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
to_series() -> pd.Series
¶
Return the flattened estimate as a labelled pandas Series.
Source code in src/mfdro/signal.py
106 107 108 109 | |
PathDiagnostics¶
mfdro.signal.PathDiagnostics(formations: pd.DataFrame, config: SignalConfig, source_start: pd.Timestamp, source_end: pd.Timestamp, n_observations: int, n_assets: int)
dataclass
¶
Non-numerical readiness report for a requested walk-forward path.
n_formations: int
property
¶
Return the number of inspected formations.
n_ready: int
property
¶
Return the number of formations ready for numerical estimation.
n_insufficient: int
property
¶
Return the number of insufficient formations.
is_usable: bool
property
¶
Return whether at least one formation can be estimated.
summary() -> dict[str, object]
¶
Return a compact machine-readable diagnostic summary.
Source code in src/mfdro/signal.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
PathProgress¶
mfdro.signal.PathProgress(completed: int, total: int, date: pd.Timestamp, status: Literal['estimated', 'skipped'], reason: SkipReason | None = None)
dataclass
¶
One progress notification emitted by :meth:estimate_path.
SkipReason¶
mfdro.signal.SkipReason
¶
Bases: str, Enum
Machine-readable reason why a requested formation was not estimated.
SignalPath¶
mfdro.signal.SignalPath(estimates: pd.DataFrame, audit: pd.DataFrame, config: SignalConfig, skipped: pd.DataFrame = pd.DataFrame())
dataclass
¶
Signal estimates and window-level audit produced walk-forward.
The three DataFrames retain stable columns even when empty. Convenience accessors expose the most common series without discarding the complete audit tables.
rho: pd.Series
property
¶
Return a copy of rho indexed by successful formation date.
sqrt_rho: pd.Series
property
¶
Return a copy of sqrt_rho indexed by successful formation date.
successful_dates: pd.DatetimeIndex
property
¶
Return successful formation dates in path order.
skipped_dates: pd.DatetimeIndex
property
¶
Return skipped formation dates in path order.
dispersion_weights: pd.DataFrame
property
¶
Return dates and normalized dispersion weights.
center_weights: pd.DataFrame
property
¶
Return dates and normalized barycenter weights.
summary() -> dict[str, object]
¶
Return a compact path summary without reducing the audit trail.
Source code in src/mfdro/signal.py
253 254 255 256 257 258 259 260 261 262 263 | |
save(directory: str | Path, *, overwrite: bool = False) -> Path
¶
Persist results, audit, skipped formations, config, and checksums.
The portable JSON-table format avoids unsafe pickle deserialization and does not require an optional Parquet engine.
Source code in src/mfdro/signal.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
load(directory: str | Path) -> SignalPath
classmethod
¶
Load and integrity-check a path written by :meth:save.
Format-1 paths remain readable. Their per-frequency distances cannot
be reconstructed from the aggregate signal, so the migrated columns
contain NaN. Saving the returned object writes the current format.
Source code in src/mfdro/signal.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |