midsommer Svelte Themes

Midsommer

A JS library and Svelte component that implements and visualizes a self-organizing map (SOM)

Midsommer

A bare-bones implmentation of the self-organizing map algorithm—and a way to visualize it.

(An animated GIF of the first 10 iterations of a self-organizing map represenging the ~300-odd book I've read since 2020. Created with Midsommer.)

What is a self-organizing map?

A SOM is a neural network that can be used to reduce the dimensions of long vectors. It was inveted by Teuvo Kohonen in the '80s. For more, check out Wikipedia.

How to use it.

If you're working in just a JavaScript environment, this should work just fine.

import { SOM } from "midsommer";

const config = {
    // see config options below.
}

const som = new SOM(config);
som.train(data);

For an example of its usage in a Svelte context, please see /src/routes/+page.svelte.

The example.

Run npm run dev -- --open to see the example application, which shows a self-organizing map of senators in the 117th congress. The vectors are descriptions of their votes.

The data for the example is drawn from Voteview data for the Senate during the 117th Congress.

Lewis, Jeffrey B., Keith Poole, Howard Rosenthal, Adam Boche, Aaron Rudkin, and Luke Sonnet (2023). Voteview: Congressional Roll-Call Votes Database. https://voteview.com/

Top categories

Loading Svelte Themes