Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Notebook 4: Message–market mismatch (2D toy)

Vectors in (\mathbb{R}^2): need vs message. Mismatch = Euclidean distance; conversion proxy (\propto 1/(1+\text{mismatch})).

from __future__ import annotations

import numpy as np

need = np.array([0.8, 0.2])
message = np.array([0.5, 0.5])


def mismatch(a: np.ndarray, b: np.ndarray) -> float:
    return float(np.linalg.norm(a - b))


def conversion_proxy(mm: float) -> float:
    return 1.0 / (1.0 + mm)


mm = mismatch(need, message)
mm, conversion_proxy(mm)
# sweep message clarity: move message toward need
alphas = np.linspace(0, 1, 21)
conv = []
for alpha in alphas:
    m = (1 - alpha) * message + alpha * need
    conv.append(conversion_proxy(mismatch(need, m)))

import matplotlib.pyplot as plt

plt.style.use("dark_background")
fig, ax = plt.subplots()
ax.plot(np.linspace(0, 1, 21), conv)
ax.set_xlabel("interp toward need (0=original msg, 1=need)")
ax.set_ylabel("conversion proxy")
plt.show()