MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / exactCorrelation

Function exactCorrelation

src/compute-engine/library/statistics.ts:957–987  ·  view source on GitHub ↗

Exact Pearson r; `null` if a variance is zero (division by zero).

(
  ce: ComputeEngine,
  xs: Expression[],
  ys: Expression[]
)

Source from the content-addressed store, hash-verified

955 return ce.function(
956 'List',
957 counts.map((count, i) =>
958 ce._fn('Tuple', [ce.number(binEdges[i]), ce.number(count)])
959 )
960 );
961 },
962 },
963
964 BinCounts: {
965 description: 'Count the number of elements falling into each bin.',
966 complexity: 8200,
967 // Same widened bin spec as Histogram (non-integer counts stay inert).
968 signature: '(collection<any>, number | list<number>) -> list<number>',
969 examples: ['BinCounts([1, 2, 2, 3], 3) // Returns [1, 2, 1]'],
970 // Decline-only, same `computeBinning` precondition as `Histogram`.
971 canEnumerate: canEnumerateFiniteSource,
972 evaluate: ([xs, binsArg], { engine: ce }) => {
973 const binning = computeBinning(xs, binsArg);
974 if (!binning) return undefined;
975 if (binning.rejected)
976 return dataConstraintError(
977 ce,
978 'BinCounts',
979 binning.rejected.value,
980 binning.rejected.constraint
981 );
982
983 return ce.function(
984 'List',
985 binning.counts.map((c) => ce.number(c))
986 );
987 },
988 },
989
990 SlidingWindow: {

Callers 1

evaluateCorrelationFunction · 0.85

Calls 10

powiFunction · 0.85
addFunction · 0.70
multiplyFunction · 0.70
subtractFunction · 0.70
divideFunction · 0.70
mapMethod · 0.65
numberMethod · 0.65
isSameMethod · 0.65
evaluateMethod · 0.65
functionMethod · 0.65

Tested by

no test coverage detected