Input Features of a Hierarchical Structure

I have input features of a hierarchical structure. Each feature consists of a header element and 0 to n subfeatures of the same structure. Also, there is no upper limit for n and n can be different from feature to feature. It should also be possible to establish relationships between features with a different number of subfeatures.

How can I format this data so that it can be used to train different (machine) learning algorithms?

Example of one input feature with 2 subfeatures:

header code=21268_2 date_begin=2018-07-07T00:00:00 date_end=2018-07-07T00:00:00 reason=“2”
     d code=I6/
     class=general”/
/header
subelements
    record amount=69.02 code=“439.0010 date_begin=2018-07-07T00:00:00 date_end=2018-07-07T00:00:00 quantity=1 record_id=2 tariff_type=001 unit_factor=0.82/
    record amount=46.32 code=“93.1950 date_begin=2018-07-07T12:00:00 date_end=2018-07-07T12:00:00 quantity=1 record_id=5 tariff_type=001 unit_factor=0.82/
/subelements

Topic deep-learning hierarchical-data-format machine-learning

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.