27 #ifndef SRC_METHPODS_RING_ML_HPP_ 28 #define SRC_METHPODS_RING_ML_HPP_ 47 template<
class UserNodeLabel,
class UserEdgeLabel>
58 enum LEDMethod_ {LSAPE_OPTIMAL, LSAPE_GREEDY, GAMMA};
60 enum SortMethod_ {STD, COUNTING};
63 Layer_(std::size_t level);
67 std::vector<LabelID> node_labels;
69 std::vector<LabelID> inner_edge_labels;
71 std::vector<LabelID> outer_edge_labels;
77 std::vector<Layer_> layers;
80 typedef std::map<GEDGraph::NodeID, Ring_> NodeRingMap_;
82 std::map<GEDGraph::GraphID, NodeRingMap_> rings_;
84 LEDMethod_ led_method_;
86 SortMethod_ sort_method_;
88 bool use_topological_features_;
90 bool use_global_features_;
92 std::size_t num_layers_;
94 std::vector<double> global_features_;
104 virtual bool ml_parse_option_(
const std::string & option,
const std::string & arg)
final;
120 void set_num_layers_();
122 void build_rings_(
const GEDGraph & graph);
126 void add_global_features_(std::vector<double> & feature_vector)
const;
128 void add_layer_substitution_features_(
const Ring_ & ring_i,
const Ring_ & ring_k, std::size_t level, std::vector<double> & feature_vector)
const;
130 void add_layer_deletion_features_(
const Ring_ & ring, std::size_t level, std::vector<double> & feature_vector)
const;
132 void add_layer_insertion_features_(
const Ring_ & ring, std::size_t level, std::vector<double> & feature_vector)
const;
134 void add_layer_features_(
const Layer_ & lhs,
const Layer_ & rhs, std::vector<double> & feature_vector)
const;
136 double lsape_multiset_cost_(
const std::vector<LabelID> & lhs,
const std::vector<LabelID> & rhs,
bool node_labels)
const;
138 double gamma_multiset_cost_(
const std::vector<LabelID> & lhs,
const std::vector<LabelID> & rhs,
bool node_labels)
const;
virtual void ml_init_for_num_features_() final
Initializes the derived class for running with feature vectors of size ged::MLBasedMethod::num_featur...
Contains the standardized input data along with basic functionality.
virtual void ml_populate_substitution_feature_vector_(const GEDGraph &g, const GEDGraph &h, GEDGraph::NodeID i, GEDGraph::NodeID k, std::vector< double > &feature_vector) final
Computes substitution feature vector.
virtual std::string ml_valid_options_string_() const final
Returns string of all valid options that are not among the ones shared by all derived classes of ged:...
virtual void ml_set_default_options_() final
Sets all options that are not among the ones shared by all derived classes of ged::MLBasedMethod to d...
virtual void ml_populate_deletion_feature_vector_(const GEDGraph &g, GEDGraph::NodeID i, std::vector< double > &feature_vector) final
Computes deletion feature vector.
virtual bool ml_parse_option_(const std::string &option, const std::string &arg) final
Parses one option that is not among the ones shared by all derived classes of ged::MLBasedMethod.
Uses ring structures for defining feature vectors for node edit operations.
virtual void ml_init_graph_(const GEDGraph &graph) final
Initializes global variables for one graph.
The normalized input graphs used by GEDLIB. All labels are integers.
virtual void ml_populate_insertion_feature_vector_(const GEDGraph &h, GEDGraph::NodeID k, std::vector< double > &feature_vector) final
Computes insertion feature vector.
Global namespace for GEDLIB.
Abstract class for methods that transform GED to LSAPE by using a SVM or a DNN to predict the cost of...
virtual std::size_t ml_get_num_features_() final
Returns the number of features.
std::size_t NodeID
Internally used vertex ID type.
virtual void ml_init_feature_variables_(const GEDGraph &g, const GEDGraph &h, std::size_t num_threads) final
Initializes variables that are used for populating the feature vectors of assignments between two inp...