MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / linear_slope

Function linear_slope

scripts/memlab-report.py:68–78  ·  view source on GitHub ↗

Least-squares slope over sample index. Resistant to the single-outlier reading that a first-vs-last delta would treat as the whole trend.

(values)

Source from the content-addressed store, hash-verified

66
67
68def linear_slope(values):
69 """Least-squares slope over sample index. Resistant to the single-outlier
70 reading that a first-vs-last delta would treat as the whole trend."""
71 n = len(values)
72 if n < 2:
73 return 0.0
74 mean_x = (n - 1) / 2.0
75 mean_y = sum(values) / n
76 num = sum((i - mean_x) * (v - mean_y) for i, v in enumerate(values))
77 den = sum((i - mean_x) ** 2 for i in range(n))
78 return num / den if den else 0.0
79
80
81def parse_census(path):

Callers 1

reportFunction · 0.85

Calls 2

sumFunction · 0.85
rangeFunction · 0.85

Tested by

no test coverage detected