pulsatrix 1.1.0
Loading...
Searching...
No Matches
topology_documents.hpp
Go to the documentation of this file.
1
12#pragma once
13
14#include <cstdint>
15#include <string>
16#include <string_view>
17#include <vector>
18
22
23namespace pulsatrix {
24
28 int dimension = 0;
30 std::vector<double> births;
31 std::vector<double> deaths;
35 double error_bound = 0;
38 std::vector<double> p_values;
44 double bootstrap_band = 0;
45
46 [[nodiscard]] size_t size() const { return births.size(); }
47};
48
51 std::string title;
53 std::string filtration = "rips";
55 std::string source;
57 int64_t num_points = 0;
60 double threshold = 0;
62 std::vector<PersistenceDiagramEntry> diagrams;
63
65 [[nodiscard]] const PersistenceDiagramEntry* find(int dimension) const;
66 [[nodiscard]] PersistenceDiagramEntry* find(int dimension);
67};
68
72[[nodiscard]] PersistenceDiagramDocument ToPersistenceDiagramDocument(const std::vector<PersistenceDiagram>& diagrams,
73 std::string title = "");
75[[nodiscard]] PersistenceDiagramDocument ToPersistenceDiagramDocument(const RipsResult& result, std::string title = "");
76
85
89
93[[nodiscard]] bool IsSignificant(const PersistenceDiagramEntry& entry, size_t i);
94
97[[nodiscard]] std::string ToJson(const PersistenceDiagramDocument& doc);
101
102} // namespace pulsatrix
Definition acquisition_functions.hpp:16
bool IsSignificant(const PersistenceDiagramEntry &entry, size_t i)
Whether feature i of entry passed the attached tests: its p-value is below the threshold,...
void AttachSignificance(PersistenceDiagramDocument &doc, int dimension, const UniversalNullResult &test)
Adds UniversalNullTest()'s p-values and corrected threshold to the entry for dimension....
void AttachBootstrapBand(PersistenceDiagramDocument &doc, int dimension, const BootstrapBandResult &band)
Adds BootstrapBand()'s band to the entry for dimension.
PersistenceDiagramDocument ParsePersistenceDiagramDocument(std::string_view json)
Reads a document ToJson() wrote.
JsonValue ToJson(const AttackResult &result, const AttackOptions &options)
The result as a pulsatrix.attack.v1 document, without the adversarial inputs.
PersistenceDiagramDocument ToPersistenceDiagramDocument(const std::vector< PersistenceDiagram > &diagrams, std::string title="")
The diagrams as a document: births, deaths and each diagram's error bound.
A persistence diagram: the features of one homology dimension, each born at one scale and dying at a ...
Persistent homology of the Vietoris-Rips filtration in every dimension up to a maximum: components (H...
Is a loop real? Significance tests for persistence diagrams: the universal null distribution,...
BootstrapBand()'s result.
Definition significance.hpp:84
Persistence diagrams of one point cloud, one entry per homology dimension.
Definition topology_documents.hpp:50
double threshold
The largest scale the filtration was computed to (RipsResult::threshold); 0 when unknown....
Definition topology_documents.hpp:60
std::string title
Definition topology_documents.hpp:51
std::string source
What the points were, for example "SmolLM2-135M, layer 12, weekday tokens".
Definition topology_documents.hpp:55
PersistenceDiagramEntry * find(int dimension)
const PersistenceDiagramEntry * find(int dimension) const
The entry for dimension, or nullptr.
std::string filtration
The filtration that made the diagrams, for example "rips".
Definition topology_documents.hpp:53
std::vector< PersistenceDiagramEntry > diagrams
One per dimension, each dimension at most once.
Definition topology_documents.hpp:62
int64_t num_points
How many points; 0 when unknown.
Definition topology_documents.hpp:57
One homology dimension of a PersistenceDiagramDocument.
Definition topology_documents.hpp:26
std::vector< double > p_values
Empty, or one p-value per feature; NaN for a feature that wasn't tested, such as an essential one....
Definition topology_documents.hpp:38
size_t size() const
Definition topology_documents.hpp:46
double error_bound
PersistenceDiagram::error_bound: every point is within this distance of where the exact distances wou...
Definition topology_documents.hpp:35
std::vector< double > deaths
Definition topology_documents.hpp:31
std::vector< double > births
One birth and one death per feature; a death of +infinity for an essential feature.
Definition topology_documents.hpp:30
int dimension
0 for components, 1 for loops, 2 for voids.
Definition topology_documents.hpp:28
double bootstrap_band
A bootstrap confidence band (BootstrapBandResult::band); 0 for none. Features with persistence above ...
Definition topology_documents.hpp:44
double significance_threshold
A feature is significant when its p-value is below this; 0 when there are no p-values....
Definition topology_documents.hpp:41
ComputeRipsPersistence()'s result.
Definition rips_persistence.hpp:81
UniversalNullTest()'s result.
Definition significance.hpp:47