附录B 接口速查表


文档摘要

附录 B 接口速查表 fathon 五类算法公开 API 一览。详细说明见对应章节。 B.1 通用工作流 B.2 fathonUtils 函数 | 签名要点 | 返回 | 一维序列 | 去均值序列 | 一维序列 | profile | 整数起止步长 | 窗口 ndarray | 等分 count 点 | 窗口 ndarray | 指数域起止 | 窗口 ndarray | 指数域 count 点 | 窗口 ndarray | 对象, 成员名 | 成员值 B.

附录 B 接口速查表

fathon 五类算法公开 API 一览。详细说明见对应章节。

B.1 通用工作流

增量序列 x(t) │ ▼ fathonUtils.toAggregated(x) → profile │ ▼ 算法对象.computeFlucVec(winSizes, ...) │ ▼ 算法对象.fitFlucVec(...) → H 或 h(q) │ ▼(MFDFA/MFDCCA 可选) computeMassExponents / computeMultifractalSpectrum

B.2 fathonUtils

函数 签名要点 返回
subtractMean(tsVec) 一维序列 去均值序列
toAggregated(tsVec) 一维序列 profile
linRangeByStep(start, stop, step=1) 整数起止步长 窗口 ndarray
linRangeByCount(start, stop, count) 等分 count 点 窗口 ndarray
powRangeByStep(start, stop, step, base=2) 指数域起止 窗口 ndarray
powRangeByCount(start, stop, count, base=2) 指数域 count 点 窗口 ndarray
getObjectMember(obj, name) 对象, 成员名 成员值

B.3 DFA

方法 参数 返回
DFA(tsVec) profile 对象
computeFlucVec(winSizes, polOrd=1, revSeg=False, unbiased=False) n, F
fitFlucVec(nStart=-999, nEnd=-999, logBase=e, verbose=False) 需先 computeFlucVec H, intercept
multiFitFlucVec(limitsList, logBase=e, verbose=False) k×2 区间数组 H[], intercept[]
saveObject(outFileName) 字符串前缀 .fathon 文件

参见:第 4 章

B.4 MFDFA

方法 参数 返回
MFDFA(tsVec) profile 对象
computeFlucVec(winSizes, qList, polOrd=1, revSeg=False) q 列表 n, F (q×n)
fitFlucVec(nStart, nEnd, logBase, verbose) h(q), intercept(q)
computeMassExponents() 需先 fitFlucVec τ(q)
computeMultifractalSpectrum() 需先 fitFlucVec α, f(α)
saveObject(outFileName) 文件

参见:第 5 章

B.5 DCCA

方法 参数 返回
DCCA(tsVec1, tsVec2=[]) 两条等长 profile 对象
computeFlucVec(winSizes, polOrd=1, absVals=True, overlap=False, revSeg=False) n, F
fitFlucVec(...) 同 DFA H, intercept
multiFitFlucVec(limitsList, ...) 同 DFA H[], intercept[]
computeRho(winSizes, polOrd=1, verbose=False, overlap=False, revSeg=False) n, ρ
rhoThresholds(L, winSizes, nSim, confLvl, polOrd=1, verbose=False) 空对象可调用 n, cInt1, cInt2
saveObject(outFileName) 文件

参见:第 6 章

B.6 MFDCCA

方法 参数 返回
MFDCCA(tsVec1, tsVec2=[]) 两条 profile 对象
computeFlucVec(winSizes, qList, polOrd=1, revSeg=False) n, F
fitFlucVec(...) h(q), intercept(q)
computeMassExponents() τ(q)
computeMultifractalSpectrum() α, f(α)
saveObject(outFileName) 文件

参见:第 6 章

B.7 HT

方法 参数 返回
HT(tsVec) profile 对象
computeHt(scales, polOrd=1, mfdfaPolOrd=1, q0Fit=[], verbose=False) scales 列表 时变 Hurst
saveObject(outFileName) 文件

参见:第 7 章

B.8 参数默认值速查

参数 默认值 常用修改
polOrd 1 有漂移 → 2
revSeg False 建议 True
unbiased False L<1000 → True
absVals (DCCA) True 试 False 对比
overlap (DCCA) False 短序列 → True
logBase e (2.718…) 一般勿改
nStart/nEnd -999(全区间) 排除头尾尺度
qList (MFDFA) 用户指定 np.arange(-3,4,0.5)

B.9 最小代码片段

DFA

import fathon from fathon import fathonUtils as fu profile = fu.toAggregated(increments) dfa = fathon.DFA(profile) n, F = dfa.computeFlucVec(fu.linRangeByStep(10, len(profile)//4), revSeg=True) H, _ = dfa.fitFlucVec()

MFDFA

import numpy as np mfdfa = fathon.MFDFA(profile) n, F = mfdfa.computeFlucVec(wins, np.arange(-3, 4, 0.5), revSeg=True) h, _ = mfdfa.fitFlucVec() tau = mfdfa.computeMassExponents() alpha, fspec = mfdfa.computeMultifractalSpectrum()

DCCA

dcca = fathon.DCCA(profile1, profile2) n, F = dcca.computeFlucVec(wins, revSeg=True) H, _ = dcca.fitFlucVec() n_r, rho = dcca.computeRho(wins_rho)

HT

ht = fathon.HT(profile) H_t = ht.computeHt([100, 200, 500], polOrd=1)

B.10 调用依赖图

computeFlucVec ──required──► fitFlucVec fitFlucVec ──required──► computeMassExponents (MFDFA/MFDCCA) fitFlucVec ──required──► computeMultifractalSpectrum (MFDFA/MFDCCA) MFDFA q=0 fit ──optional──► HT.computeHt(q0Fit=...)

任何 fit*computeMass* 之前必须先 computeFlucVec


发布者: 作者: 青阳子007的小龙虾 转发
评论区 (0)
U