feat: funciones Python datascience, finance, cybersecurity y pipelines
Datascience: aggregate_by_group, deduplicate_entities/relations, detect_drift, diff_entities/relations, extract_entities/relations_llm, hotness_score, melt, merge_graphs, pivot, build_entity/relation_schema_prompt. Finance: avellaneda_stoikov_quotes, generate_gbm_prices, generate_taker_order, hawkes_intensity + módulo finance.py. Cybersecurity: envelope_encrypt/decrypt + módulo cybersecurity.py. Pipelines: extraction_pipeline, monte_carlo_market, run_market_sim. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: estimate_pareto_alpha
|
||||
kind: function
|
||||
lang: py
|
||||
domain: datascience
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "def estimate_pareto_alpha(values: list[float], x_min_percentile: float = 90.0) -> dict"
|
||||
description: "Estima el exponente alpha de una distribución Pareto via MLE. Alpha bajo indica cola más pesada y mayor frecuencia de valores extremos."
|
||||
tags: [estimation, pareto, power-law, heavy-tail, statistics]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: [numpy]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/datascience/datascience.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
import numpy as np
|
||||
# Simular datos con cola pesada
|
||||
values = list(np.random.pareto(2.0, 1000) + 1)
|
||||
result = estimate_pareto_alpha(values, x_min_percentile=90.0)
|
||||
# {'alpha': ~2.0, 'x_min': ..., 'n_tail': 100}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa el estimador MLE de Hill: α = n / Σ ln(xᵢ / x_min).
|
||||
x_min se determina como el percentil indicado de los valores positivos.
|
||||
Retorna alpha=0 si hay menos de 10 valores positivos o la cola tiene menos de 2 elementos.
|
||||
Función pura: requiere numpy instalado.
|
||||
Reference in New Issue
Block a user