|
| | MergeTreeNeuralNetwork () |
| |
| void | execute (std::vector< ftm::MergeTree< float > > &trees, std::vector< ftm::MergeTree< float > > &trees2) |
| |
| | Debug () |
| |
| | ~Debug () override |
| |
| virtual int | setDebugLevel (const int &debugLevel) |
| |
| int | setWrapper (const Wrapper *wrapper) override |
| |
| int | printMsg (const std::string &msg, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const std::vector< std::string > &msgs, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
| |
| int | printErr (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
| |
| int | printWrn (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
| |
| int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const double &memory, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const std::string &msg, const double &progress, const double &time, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const std::string &msg, const double &progress, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const std::string &msg, const double &progress, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const std::vector< std::vector< std::string > > &rows, const debug::Priority &priority=debug::Priority::INFO, const bool hasHeader=true, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const debug::Separator &separator, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
| |
| int | printMsg (const std::string &msg, const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
| |
| void | setDebugMsgPrefix (const std::string &prefix) |
| |
| | BaseClass () |
| |
| virtual | ~BaseClass ()=default |
| |
| int | getThreadNumber () const |
| |
| virtual int | setThreadNumber (const int threadNumber) |
| |
| | MergeTreeNeuralBase () |
| |
| | MergeTreeAxesAlgorithmBase () |
| |
| void | setDeterministic (const bool deterministic) |
| |
| void | setNumberOfProjectionSteps (const unsigned int k) |
| |
| void | setBarycenterSizeLimitPercent (const double barycenterSizeLimitPercent) |
| |
| void | setProbabilisticVectorsInit (const bool probabilisticVectorsInit) |
| |
| template<class dataType> |
| void | computeOneDistance (const ftm::MergeTree< dataType > &tree1, const ftm::MergeTree< dataType > &tree2, std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > &matching, dataType &distance, bool isCalled=false, bool useDoubleInput=false, bool isFirstInput=true) |
| |
| template<class dataType> |
| void | computeOneDistance (const ftm::MergeTree< dataType > &tree1, const ftm::MergeTree< dataType > &tree2, dataType &distance, bool isCalled=false, bool useDoubleInput=false, bool isFirstInput=true) |
| |
| template<class dataType> |
| void | initVectorFromMatching (ftm::MergeTree< dataType > &barycenter, ftm::MergeTree< dataType > &tree, std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > &matching, std::vector< std::vector< double > > &v) |
| |
| template<class dataType> |
| void | initRandomVector (ftm::MergeTree< dataType > &barycenter, std::vector< std::vector< double > > &v, std::vector< std::vector< std::vector< double > > > &vS, std::vector< std::vector< std::vector< double > > > &v2s) |
| |
| template<class dataType, typename F> |
| int | initVectors (int axeNumber, ftm::MergeTree< dataType > &barycenter, std::vector< ftm::MergeTree< dataType > > &trees, ftm::MergeTree< dataType > &barycenter2, std::vector< ftm::MergeTree< dataType > > &trees2, std::vector< std::vector< double > > &v1, std::vector< std::vector< double > > &v2, std::vector< std::vector< double > > &trees2V1, std::vector< std::vector< double > > &trees2V2, int newVectorOffset, std::vector< double > &inputToOriginDistances, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &baryMatchings, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &baryMatchings2, std::vector< std::vector< double > > &inputToAxesDistances, std::vector< std::vector< std::vector< double > > > &vS, std::vector< std::vector< std::vector< double > > > &v2s, std::vector< std::vector< std::vector< double > > > &trees2Vs, std::vector< std::vector< std::vector< double > > > &trees2V2s, bool projectInitializedVectors, F initializedVectorsProjection) |
| |
| template<class dataType> |
| void | computeOneBarycenter (std::vector< ftm::MergeTree< dataType > > &trees, ftm::MergeTree< dataType > &baryMergeTree, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &matchings, std::vector< double > &finalDistances, double barycenterSizeLimitPercent, unsigned int barycenterMaximumNumberOfPairs, int barycenterInitIndex, bool oneIter, bool useDoubleInput=false, bool isFirstInput=true) |
| |
| template<class dataType> |
| void | computeOneBarycenter (std::vector< ftm::MergeTree< dataType > > &trees, ftm::MergeTree< dataType > &baryMergeTree, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &matchings, std::vector< double > &finalDistances, double barycenterSizeLimitPercent, unsigned int barycenterMaximumNumberOfPairs, bool useDoubleInput=false, bool isFirstInput=true) |
| |
| template<class dataType> |
| void | computeOneBarycenter (std::vector< ftm::MergeTree< dataType > > &trees, ftm::MergeTree< dataType > &baryMergeTree, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &matchings, std::vector< double > &finalDistances, double barycenterSizeLimitPercent, bool useDoubleInput=false, bool isFirstInput=true) |
| |
| template<class dataType> |
| void | computeOneBarycenter (std::vector< ftm::MergeTree< dataType > > &trees, ftm::MergeTree< dataType > &baryMergeTree, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &matchings, std::vector< double > &finalDistances, bool useDoubleInput=false, bool isFirstInput=true) |
| |
| template<class dataType> |
| void | computeOneBarycenter (std::vector< ftm::MergeTree< dataType > > &trees, ftm::MergeTree< dataType > &baryMergeTree, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &matchings) |
| |
| template<class dataType> |
| void | computeOneBarycenter (std::vector< ftm::MergeTree< dataType > > &trees, ftm::MergeTree< dataType > &baryMergeTree) |
| |
| template<class dataType> |
| void | preprocessingTrees (std::vector< ftm::MergeTree< dataType > > &trees, std::vector< std::vector< int > > &nodeCorr, bool useMinMaxPairT=true) |
| |
| template<class dataType> |
| void | preprocessingTrees (std::vector< ftm::MergeTree< dataType > > &trees, bool useMinMaxPairT=true) |
| |
| template<class dataType> |
| std::tuple< dataType, dataType > | getParametrizedBirthDeath (ftm::FTMTree_MT *tree, ftm::idNode node) |
| |
| template<class dataType> |
| void | computeBranchesCorrelationMatrix (const ftm::MergeTree< dataType > &barycenter, std::vector< ftm::MergeTree< dataType > > &trees, std::vector< std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > > &baryMatchings, std::vector< std::vector< double > > &allTs, std::vector< std::vector< double > > &branchesCorrelationMatrix, std::vector< std::vector< double > > &persCorrelationMatrix) |
| |
| | MergeTreeBase () |
| |
| void | setAssignmentSolver (int assignmentSolver) |
| |
| void | setEpsilon1UseFarthestSaddle (bool b) |
| |
| void | setEpsilonTree1 (double epsilon) |
| |
| void | setEpsilonTree2 (double epsilon) |
| |
| void | setEpsilon2Tree1 (double epsilon) |
| |
| void | setEpsilon2Tree2 (double epsilon) |
| |
| void | setEpsilon3Tree1 (double epsilon) |
| |
| void | setEpsilon3Tree2 (double epsilon) |
| |
| void | setPersistenceThreshold (double pt) |
| |
| void | setParallelize (bool para) |
| |
| void | setNodePerTask (int npt) |
| |
| void | setBranchDecomposition (bool useBD) |
| |
| void | setNormalizedWasserstein (bool normalizedWasserstein) |
| |
| void | setKeepSubtree (bool keepSubtree) |
| |
| void | setNonMatchingWeight (double weight) |
| |
| void | setBarycenterMergeTree (bool imt) |
| |
| void | setDistanceSquaredRoot (bool distanceSquaredRoot) |
| |
| void | setUseMinMaxPair (bool useMinMaxPair) |
| |
| void | setDeleteMultiPersPairs (bool deleteMultiPersPairsT) |
| |
| void | setCleanTree (bool clean) |
| |
| void | setIsPersistenceDiagram (bool isPD) |
| |
| void | setJoinSplitMixtureCoefficient (const double mixtureCoefficient) |
| |
| void | setUseDoubleInput (const bool useDoubleInput) |
| |
| std::vector< std::vector< int > > | getTreesNodeCorr () |
| |
| double | mixDistancesMinMaxPairWeight (bool isFirstInput) |
| |
| double | mixDistancesWeight (bool isFirstInput) |
| |
| template<class dataType> |
| double | mixDistances (dataType distance1, dataType distance2) |
| |
| template<class dataType> |
| void | mixDistancesMatrix (std::vector< std::vector< dataType > > &distanceMatrix, std::vector< std::vector< dataType > > &distanceMatrix2) |
| |
| template<class dataType> |
| void | mergeSaddle (ftm::FTMTree_MT *tree, double epsilon, std::vector< std::vector< ftm::idNode > > &treeNodeMerged, bool mergeByPersistence=false) |
| |
| template<class dataType> |
| void | persistenceMerging (ftm::FTMTree_MT *tree, double epsilon2, double epsilon3=100) |
| |
| void | deletePersistenceDiagramsPairs (ftm::FTMTree_MT *tree, std::vector< ftm::idNode > &nodes) |
| |
| template<class dataType> |
| void | keepMostImportantPairs (ftm::FTMTree_MT *tree, int n, bool useBD) |
| |
| template<class dataType> |
| void | persistenceThresholding (ftm::FTMTree_MT *tree, double persistenceThresholdT, std::vector< ftm::idNode > &deletedNodes) |
| |
| template<class dataType> |
| void | persistenceThresholding (ftm::FTMTree_MT *tree, std::vector< ftm::idNode > &deletedNodes) |
| |
| template<class dataType> |
| void | persistenceThresholding (ftm::FTMTree_MT *tree, double persistenceThresholdT) |
| |
| template<class dataType> |
| void | persistenceThresholding (ftm::FTMTree_MT *tree) |
| |
| template<class dataType> |
| void | verifyOrigins (ftm::FTMTree_MT *tree) |
| |
| template<class dataType> |
| void | preprocessTree (ftm::FTMTree_MT *tree, bool deleteInconsistentNodes=true) |
| |
| template<class dataType> |
| ftm::FTMTree_MT * | computeBranchDecomposition (ftm::FTMTree_MT *tree, std::vector< std::vector< ftm::idNode > > &treeNodeMerged) |
| |
| template<class dataType> |
| void | dontUseMinMaxPair (ftm::FTMTree_MT *tree) |
| |
| void | verifyPairsTree (ftm::FTMTree_MT *tree) |
| |
| template<class dataType> |
| void | deleteMultiPersPairs (ftm::FTMTree_MT *tree, bool useBD) |
| |
| template<class dataType> |
| void | preprocessingPipeline (ftm::MergeTree< dataType > &mTree, double epsilonTree, double epsilon2Tree, double epsilon3Tree, bool branchDecompositionT, bool useMinMaxPairT, bool cleanTreeT, double persistenceThreshold, std::vector< int > &nodeCorr, bool deleteInconsistentNodes=true) |
| |
| template<class dataType> |
| void | preprocessingPipeline (ftm::MergeTree< dataType > &mTree, double epsilonTree, double epsilon2Tree, double epsilon3Tree, bool branchDecompositionT, bool useMinMaxPairT, bool cleanTreeT, std::vector< int > &nodeCorr, bool deleteInconsistentNodes=true) |
| |
| void | reverseNodeCorr (ftm::FTMTree_MT *tree, std::vector< int > &nodeCorr) |
| |
| template<class dataType> |
| void | mtFlattening (ftm::MergeTree< dataType > &mt) |
| |
| template<class dataType> |
| void | mtsFlattening (std::vector< ftm::MergeTree< dataType > > &mts) |
| |
| double | getSizeLimitMetric (std::vector< ftm::FTMTree_MT * > &trees) |
| |
| template<class dataType> |
| void | copyMinMaxPair (ftm::MergeTree< dataType > &mTree1, ftm::MergeTree< dataType > &mTree2, bool setOrigins=false) |
| |
| template<class dataType> |
| std::tuple< int, dataType > | fixMergedRootOrigin (ftm::FTMTree_MT *tree) |
| |
| template<class dataType> |
| void | branchDecompositionToTree (ftm::FTMTree_MT *tree) |
| |
| template<class dataType> |
| void | putBackMergedNodes (ftm::FTMTree_MT *tree) |
| |
| template<class dataType> |
| void | postprocessingPipeline (ftm::FTMTree_MT *tree) |
| |
| template<class dataType> |
| void | convertBranchDecompositionMatching (ftm::FTMTree_MT *tree1, ftm::FTMTree_MT *tree2, std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > &outputMatching) |
| |
| template<class dataType> |
| void | convertBranchDecompositionMatching (ftm::FTMTree_MT *tree1, ftm::FTMTree_MT *tree2, std::vector< std::tuple< ftm::idNode, ftm::idNode > > &outputMatching) |
| |
| template<class dataType> |
| void | identifyRealMatching (ftm::FTMTree_MT *tree1, ftm::FTMTree_MT *tree2, std::vector< std::tuple< ftm::idNode, ftm::idNode > > &outputMatching, std::vector< std::tuple< ftm::idNode, ftm::idNode, bool > > &realMatching) |
| |
| template<class dataType> |
| dataType | computeDistance (dataType x1, dataType x2, dataType y1, dataType y2, double power=2) |
| |
| template<class dataType> |
| dataType | deleteCost (const ftm::FTMTree_MT *tree, ftm::idNode nodeId) |
| |
| template<class dataType> |
| dataType | insertCost (const ftm::FTMTree_MT *tree, ftm::idNode nodeId) |
| |
| template<class dataType> |
| dataType | relabelCostOnly (const ftm::FTMTree_MT *tree1, ftm::idNode nodeId1, const ftm::FTMTree_MT *tree2, ftm::idNode nodeId2) |
| |
| template<class dataType> |
| dataType | relabelCost (const ftm::FTMTree_MT *tree1, ftm::idNode nodeId1, const ftm::FTMTree_MT *tree2, ftm::idNode nodeId2) |
| |
| void | getParamNames (std::vector< std::string > ¶mNames) |
| |
| double | getParamValueFromName (std::string ¶mName) |
| |
| void | setParamValueFromName (std::string ¶mName, double value) |
| |
| void | getTreesStats (std::vector< ftm::FTMTree_MT * > &trees, std::array< double, 3 > &stats) |
| |
| void | printTreesStats (std::vector< ftm::FTMTree_MT * > &trees) |
| |
| template<class dataType> |
| void | printTreesStats (std::vector< ftm::MergeTree< dataType > > &trees) |
| |
| template<class dataType> |
| void | printTableVector (std::vector< std::vector< dataType > > &table) |
| |
| template<class dataType> |
| void | printTable (dataType *table, int nRows, int nCols) |
| |
| void | printMatching (std::vector< MatchingType > &matchings) |
| |
| void | printMatching (std::vector< std::tuple< ftm::idNode, ftm::idNode, double > > &matchings) |
| |
| void | printMatching (std::vector< std::tuple< ftm::idNode, ftm::idNode > > &matchings) |
| |
| template<class dataType> |
| void | printPairs (std::vector< std::tuple< SimplexId, SimplexId, dataType > > &treePairs) |
| |
| template<class dataType> |
| void | printOutputMatching (std::vector< std::tuple< ftm::idNode, ftm::idNode > > &outputMatching, ftm::FTMTree_MT *tree1, ftm::FTMTree_MT *tree2, bool computeCosts=true) |
| |
The MergeTreeNeuralNetwork class provides methods to define a neural network able to process merge trees or persistence diagrams.
- Author
- Mathieu Pont mathi.nosp@m.eu.p.nosp@m.ont@l.nosp@m.ip6..nosp@m.fr
- Date
- 2023.
This module defines the MergeTreeNeuralNetwork class providing functions to define a neural network able to process merge trees or persistence diagrams.
This is an abstract class, to implement a derived class you need to define the following functions:
- "initParameters" : initializes the network, like the different layers. A strategy to initialize a sequence of layers consist in initializing a first layer with the input topological representations, then pass them through this layer to initialize the second one and so on. A simple loop (whose number of iterations corresponds to the number of layers) can do this using the "initInputBasis" and the "initOutputBasis" function, then the "initGetReconstructed" function to pass the representations to the layer that just have been initialized.
- "initResetOutputBasis" : please refer to the documentation of this function.
- "customInit" : called just before the "initStep" function (that call the "initParameters" function), is is intended to do custom operations depending on the architecture and the optimization you want to define (such as computing the distance matrix for the metric loss in the autoencoder case). This function can be empty.
- "backwardStep" : optimizes the parameters of the network. A loss using differentiable torch operations should be computed using the output of some layers of the network (usually the output of the last layer but it can also be any other layers). You can either use the torch coordinates of the representations in a layer or their torch tensors to compute the loss. Then use the torch::Tensor "backward" function to compute the gradients, then the torch::optim::Optimizer "step" function to update the model parameters, after this, the torch::optim::Optimizer "zero_grad" function should be called to reset the gradient. If you have correctly created the MergeTreeNeuralLayer objects (refer to the corresponding class documentation), basically by calling the "requires_grad" function (with true as parameter) for each layer after initializing its parameters, then everything would be automatically handled to backpropagate the gradient of the loss through the layers.
- "addCustomParameters" : adds custom parameters to the parameter list that will be given to the optimizer, depending on the architecture and the optimization you want to define (such as the centroids for the cluster loss in the autoencoder case). This function can be empty.
- "computeOneLoss" : computes the loss for one input topological representation, the loss computed here does not need to be differentiable because it will only be used to print it in the console and to check convergence of the method (i.e. it is not called in the "backwardStep" function).
- "computeCustomLosses" : computes custom losses for all input topological representations depending on the architecture and the optimization you want to define (such as the clustering and the metric loss in the autoendoer case). Like "computeOneLoss", the losses do not need to be differentiable because they will only be used to print them in the console and to check convergence of the method. This function can be empty.
- "computeIterationTotalLoss"
- "printCustomLosses" : prints the custom loss depending on the architecture and the optimization you want to define (such as the clustering and the metric loss in the autoendoer case). This function can be empty.
- "printGapLoss" : prints the "gap" loss, the aggregated loss over iterationGap_ iterations.
- "copyCustomParams" : copy the custom parameters (for instance to save them when a better loss is reached during the optimization) depending on the architecture and the optimization you want to define (such as the centroids for the cluster loss in the autoencoder case). This function can be empty.
- "executeEndFunction" : does specific operations at the end of the optimization, such as calling the "computeTrackingInformation" and the "computeCorrelationMatrix" functions.
Related publication:
"Wasserstein Auto-Encoders of Merge Trees (and Persistence Diagrams)"
Mathieu Pont, Julien Tierny.
IEEE Transactions on Visualization and Computer Graphics, 2023
Definition at line 106 of file MergeTreeNeuralNetwork.h.