ProgrammaticΒΆ

The Python API can be built without YAML by constructing ThemaRS and feeding a dataframe.

from pulsar import ThemaRS
import pandas as pd

df = pd.read_csv("data.csv")
model = ThemaRS({
    "run": {"name": "example"},
    "preprocessing": {
        "impute": {"age": {"method": "sample_normal", "seed": 42}},
        "drop_columns": []
    },
    "sweep": {
        "projection": {
            "method": "jl",
            "dimensions": {"values": [2]},
            "seed": {"values": [42]},
            "center": True,
        },
        "ball_mapper": {"epsilon": {"values": [0.5]}}
    },
    "cosmic_graph": {
        "construction": "minhash",
        "minhash_d": 256,
        "construction_threshold": "auto",
    },
    "output": {"n_reps": 3}
})
model.fit(data=df)
matrix = model.weighted_adjacency
threshold = model.resolved_construction_threshold