{"_id":"@agentix-e/causality-analyzer-pipeline","_rev":"2-0e7c896288473e3817e5655bb88abb51","name":"@agentix-e/causality-analyzer-pipeline","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.0":{"name":"@agentix-e/causality-analyzer-pipeline","version":"0.0.0","keywords":["oidc","trusted-publishing","setup"],"_id":"@agentix-e/causality-analyzer-pipeline@0.0.0","maintainers":[{"name":"lambertyan","email":"853901691@qq.com"}],"dist":{"shasum":"82af98c4ff04b4b2f717458fd38b49db95cdae8c","tarball":"https://registry.npmjs.org/@agentix-e/causality-analyzer-pipeline/-/causality-analyzer-pipeline-0.0.0.tgz","fileCount":2,"integrity":"sha512-x6rFvXWeGgiME60523hN+OW8q//uR1idKwtSoykypm6pC3y3tvrvCzmBVGS3Yx1iyBbnXL/lFcr09zHd9UdKSA==","signatures":[{"sig":"MEUCIGHXgRQe+jln4F1UejvWIfGCBcpQUa5l4jze+dg7OCDLAiEA+ZOW3hwRiYira6r5Rl1NuiV+/qczDzqfkV5PHQ+gUY4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2115},"_npmUser":{"name":"lambertyan","email":"853901691@qq.com"},"_npmVersion":"11.9.0","description":"OIDC trusted publishing setup package for @agentix-e/causality-analyzer-pipeline","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/causality-analyzer-pipeline_0.0.0_1784593459893_0.2073881285658663","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@agentix-e/causality-analyzer-pipeline","version":"0.1.0","description":"Causality Analyzer Pipeline — anomaly detection, causal graph discovery, RCA analysis, causal inference","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","test":"vitest run --coverage","lint":"eslint src/ --ext .ts","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"dependencies":{"@agentix-e/causality-analyzer-core":"workspace:*","ml-matrix":"^6.14.0","simple-statistics":"^7.8.0"},"devDependencies":{"@vitest/coverage-v8":"^3.0.0","typescript":"^5.7.0","vitest":"^3.0.0"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/AgentiX-E/causality-analyzer.git","directory":"packages/pipeline"},"gitHead":"be22baa2b8d4a5dc76c4018788ac4f7ca243784e","_id":"@agentix-e/causality-analyzer-pipeline@0.1.0","bugs":{"url":"https://github.com/AgentiX-E/causality-analyzer/issues"},"homepage":"https://github.com/AgentiX-E/causality-analyzer#readme","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-s5Q0OvH/fLfd0G7l40+8S5pxlaG6/mZY58oFGiO7ZaU+KNM7DbnbG2r1bKFmetXCkG6Z86a0qqCpfqgDltawdg==","shasum":"2b599c997043cfc79a9d1fc42fc1a15c88420324","tarball":"https://registry.npmjs.org/@agentix-e/causality-analyzer-pipeline/-/causality-analyzer-pipeline-0.1.0.tgz","fileCount":52,"unpackedSize":343625,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agentix-e%2fcausality-analyzer-pipeline@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIATnYO3NNIUag3XCH0luS00h6VlJRy0sGgjK8zLmT33OAiEAo20dvmbPIJRSp+dLf/CPD29L2vBSvBCnrmCbFW+WKYs="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:db53a773-fdb4-4fa9-be5a-0f4a0bb4f317"}},"directories":{},"maintainers":[{"name":"lambertyan","email":"853901691@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/causality-analyzer-pipeline_0.1.0_1784733563380_0.43728351813349375"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-21T00:24:19.722Z","modified":"2026-07-22T15:19:23.799Z","0.0.0":"2026-07-21T00:24:20.060Z","0.1.0":"2026-07-22T15:19:23.515Z"},"description":"Causality Analyzer Pipeline — anomaly detection, causal graph discovery, RCA analysis, causal inference","maintainers":[{"name":"lambertyan","email":"853901691@qq.com"}],"readme":"# @agentix-e/causality-analyzer-pipeline\n\n> Complete causal AI pipeline — anomaly detection, causal discovery, root cause analysis, effect estimation, counterfactual reasoning, and model evaluation.\n\n[![npm](https://img.shields.io/badge/version-0.1.0-blue)](https://www.npmjs.com/package/@agentix-e/causality-analyzer-pipeline)\n\n## Overview\n\n`@agentix-e/causality-analyzer-pipeline` is the causal reasoning engine. It implements the full stack from raw metric ingestion to counterfactual \"what-if\" analysis, including academic-grade sensitivity testing and graph validation.\n\n### Architecture\n\n```\nRaw Data → Standardize → Detect Anomalies\n                                ↓\n              Causal Discovery (PC / FCI / Targeted)\n                                ↓\n              Root Cause Analysis (Bayesian / HT / RandomWalk / CIRCA)\n                                ↓\n              Effect Estimation (Backdoor / Frontdoor / IV / PS / DR)\n                                ↓\n              Sensitivity & Refutation (E-value / pR² / Bootstrap)\n                                ↓\n              Counterfactual Reasoning (SCM → Abduction → Action → Prediction)\n                                ↓\n              Model Evaluation (R² / MSE / Shapley RCA / Distribution Change)\n```\n\n## Installation\n\n```bash\nnpm install @agentix-e/causality-analyzer-pipeline\nnpm install @agentix-e/causality-analyzer-core  # peer dependency\n```\n\n## Quick Start\n\n### 1. Anomaly Detection\n\n```typescript\nimport { StatsDetector, SpectralResidualDetector, VotingDetector } from '@agentix-e/causality-analyzer-pipeline';\n\n// Z-score detector\nconst detector = new StatsDetector({ method: 'zscore' });\ndetector.train(normalData);\nconst result = detector.update([5.2, 8.1]);  // anomalous!\n\n// Ensemble voting\nconst ensemble = new VotingDetector({\n  detectors: [statsDetector, srDetector],\n  strategy: 'majority',\n});\nconst voted = ensemble.detect(dataPoints);\n```\n\n### 2. Causal Discovery\n\n```typescript\nimport { Matrix } from 'ml-matrix';\nimport { pcAlgorithm, fciAlgorithm, targetedDiscovery } from '@agentix-e/causality-analyzer-pipeline';\n\n// PC algorithm (no latent confounders)\nconst { graph } = pcAlgorithm(data, ['CPU', 'Memory', 'Latency']);\n\n// FCI algorithm (with latent confounders)\nconst { pagEdges } = fciAlgorithm(data, nodeNames);\n\n// Targeted: only find parents of 'Latency'\nconst parents = targetedDiscovery(data, ['Latency'], nodeNames);\n```\n\n### 3. Root Cause Analysis\n\n```typescript\nimport { CausalGraph, BayesianRCA, HTRCA, CIRCAPipeline } from '@agentix-e/causality-analyzer-pipeline';\n\n// Bayesian Network RCA\nconst rca = new BayesianRCA();\nrca.train(graph, anomalousNodes, data);\nconst result = rca.findRootCauses(['CPU', 'Latency']);\n\n// Hypothesis Testing RCA (regression residuals)\nconst ht = new HTRCA();\nht.train(graph, data);\nconst htResult = ht.findRootCauses(['CPU', 'Latency'], data);\n\n// CIRCA Pipeline (KDD 2022)\nconst circa = new CIRCAPipeline(graph);\nconst circaResult = circa.analyze(anomalyData, ['CPU', 'Latency']);\n```\n\n### 4. Causal Effect Estimation\n\n```typescript\nimport {\n  adjustBackdoor, estimateIV, estimatePSMatching, estimateDoublyRobust\n} from '@agentix-e/causality-analyzer-pipeline';\n\n// Backdoor adjustment\nconst { ate, se } = adjustBackdoor(graph, 'Treatment', 'Outcome', data, nodeIndex);\n\n// Instrumental Variables (2SLS)\nconst ivResult = estimateIV(data, treatmentIdx, outcomeIdx, ivIdx);\n\n// Propensity Score Matching\nconst psmResult = estimatePSMatching(data, treatmentIdx, outcomeIdx, [confounderIdx]);\n\n// Doubly Robust\nconst drResult = estimateDoublyRobust(data, treatmentIdx, outcomeIdx, [confounderIdx]);\n```\n\n### 5. Sensitivity Analysis\n\n```typescript\nimport { eValueSensitivity, robustnessValue } from '@agentix-e/causality-analyzer-pipeline';\n\nconst { eValue, interpretation } = eValueSensitivity(0.8);\n// \"E-value=4.22: strong robustness — only very strong unmeasured confounding...\"\n\nconst { rv } = robustnessValue(0.8, 0.1, 1000);\n// \"RV=3.15: ROBUST — causal conclusion is well-supported\"\n```\n\n### 6. Counterfactual Reasoning\n\n```typescript\nimport { CausalGraph, StructuralCausalModel } from '@agentix-e/causality-analyzer-pipeline';\n\nconst scm = new StructuralCausalModel(graph);\nscm.train(data);\n\n// What would latency be if we doubled memory?\nconst noise = scm.abduct({ Memory: 0.5, CPU: 0.8, Latency: 120 });\nconst cf = scm.counterfactual(noise, { Memory: 1.0 });\n\n// Shapley-based anomaly attribution\nimport { shapleyAttribute } from '@agentix-e/causality-analyzer-pipeline';\nconst shapleyRCA = shapleyAttribute(scm, anomalousObservation, 5);\n```\n\n## API Reference\n\n📚 Full TypeDoc API: `pnpm docs` from the monorepo root.\n\n### Module Index\n\n| Module | Key Exports |\n|--------|------------|\n| `data/standardizer` | `standardize`, `discretize`, `extractWindows`, `imputeMean` |\n| `detect/stats-detector` | `StatsDetector` (zscore/mad/iqr) |\n| `detect/spectral-residual` | `SpectralResidualDetector` (FFT-based) |\n| `detect/spot` | `SPOTDetector`, `DSPOTDetector` (extreme value) |\n| `detect/voting-detector` | `VotingDetector` (majority/max/weighted) |\n| `graph/causal-graph` | `CausalGraph` (DAG/PDAG/CPDAG) |\n| `graph/pc` | `pcAlgorithm`, `fisherZTest` |\n| `graph/advanced-discovery` | `fciAlgorithm`, `growShrink`, `targetedDiscovery` |\n| `analyze/rca` | `BayesianRCA`, `RandomWalkRCA`, `HTRCA`, `FPGrowthRCA` |\n| `analyze/circa` | `RHTScorer`, `DAScorer`, `CIRCAPipeline` |\n| `infer/causal-inference` | `CausalAnalysis`, `identifyBackdoor`, `identifyFrontdoor`, `refutePlaceboTreatment`, `refuteBootstrap` |\n| `infer/effect-estimation` | `adjustBackdoor`, `estimateFrontdoor`, `estimateIV`, `estimatePSMatching`, `estimateDoublyRobust` |\n| `infer/sensitivity` | `eValueSensitivity`, `partialRSensitivity`, `robustnessValue` |\n| `infer/do-calculus` | `identifyByDoCalculus` (3 rules + ID algorithm) |\n| `infer/mediation` | `naturalDirectEffect`, `arrowStrength` |\n| `infer/cate-fairness` | `estimateCATE`, `estimateIPW`, `checkFairness` |\n| `infer/bootstrap-ci` | `bootstrapATE`, `bootstrapATEParallel`, `parallelBootstrap` |\n| `gcm/structural-causal-model` | `StructuralCausalModel`, `cateToRCA` |\n| `gcm/model-evaluation` | `evaluateMechanismR2`, `evaluateMSE`, `shapleyAttribute`, `bootstrapRCA` |\n| `gcm/nonlinear-mechanisms` | `PostNonlinearMechanism`, `fitLogisticPNL`, `autoAssignMechanisms`, `parentRelevance` |\n| `gcm/distribution-change` | `detectMechanismChanges`, `distributionChangeRobust`, `changeAttributionCI` |\n| `gcm/graph-falsification` | `falsifyGraph`, `lmcFalsification` |\n| `viz/viz-data` | `buildGraphVizData`, `buildTimeseriesVizData`, `buildRankingVizData` |\n| `viz/fusion` | `FusionAnalyzer` (metric + trace + log) |\n\n## Deterministic Reproducibility\n\nAll stochastic algorithms accept an optional `seed` parameter for reproducible results:\n\n```typescript\n// With seed → deterministic\nconst result = shapleyAttribute(scm, obs, 5, seed);\nconst ci = bootstrapRCA(scm, obs, 200, 0.05, seed);\n\n// Without seed → non-deterministic (uses Math.random)\nconst result2 = shapleyAttribute(scm, obs, 5);\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","homepage":"https://github.com/AgentiX-E/causality-analyzer#readme","repository":{"type":"git","url":"git+https://github.com/AgentiX-E/causality-analyzer.git","directory":"packages/pipeline"},"bugs":{"url":"https://github.com/AgentiX-E/causality-analyzer/issues"},"license":"MIT"}