Skip to content

vmfstream

Online story discovery that trains nothing while it reads. A memory of von Mises–Fisher nodes assigns each text to a story on arrival, by adding and forgetting statistics, and keeps a megabyte of state you can inspect.

One item at a time

Each text is read against every story the memory holds and a slot for a new one, and assigned on arrival. About half a millisecond per item on one CPU thread, whatever the length of the stream.

No training while reading

A node is three additive statistics. Adding an item is a sum, forgetting is a product. The only fitted part is a principal-component projection, computed once.

Retrieve themes

Ask the history which node matches a query at a date, which items represent a node, and which nodes were alive on a given day.

Follow stories in time

Mass of each node over time, the trajectory of its centre as the story moves, and an interactive 3-D view of the memory’s space.

from vmfstream import Memory
memory = Memory().fit_projection(reference) # PCA, once, on data that is not the stream
history = memory.read(embeddings, hours) # one node per item, decided on arrival
node, cosine = history.query(memory.project(query), time=hours_at("2022-02-24"))[0]
history.exemplars(node) # the items that best represent it
history.trajectory(node) # its centre, day by day

Every example in these docs ran on nine years of the Wikipedia Current Events Portal, and shows its real output.