mat-summarize 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mat_summarize-0.0.1.dist-info/METADATA +206 -0
- mat_summarize-0.0.1.dist-info/RECORD +21 -0
- mat_summarize-0.0.1.dist-info/WHEEL +4 -0
- mat_summarize-0.0.1.dist-info/licenses/LICENSE +674 -0
- nome/__init__.py +0 -0
- nome/method/FeatureAggregator.py +79 -0
- nome/method/MATSG.py +105 -0
- nome/method/MATSGT.py +83 -0
- nome/method/MATSummarize.py +516 -0
- nome/method/MUITAS.py +158 -0
- nome/method/__init__.py +10 -0
- nome/model/Centroid.py +133 -0
- nome/model/Feature.py +26 -0
- nome/model/MultipleAspectTrajectory.py +101 -0
- nome/model/Point.py +159 -0
- nome/model/STI.py +83 -0
- nome/model/SemanticAspect.py +59 -0
- nome/model/SemanticType.py +23 -0
- nome/model/TemporalAspect.py +85 -0
- nome/model/Util.py +37 -0
- nome/model/__init__.py +18 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mat-summarize
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A package of methods to summarize MATs
|
|
5
|
+
Project-URL: Homepage, https://github.com/RepresentantativeMAT/mat-summarization
|
|
6
|
+
Project-URL: Issues, https://github.com/RepresentantativeMAT/mat-summarization/issues
|
|
7
|
+
Author-email: Jonathan Roberto Fragoso Bonatto <jonrfbonatto@gmail.com>, Vanessa Lago Machado <vanessalagomachado@gmail.com>
|
|
8
|
+
License-Expression: GPL-3.0-only
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Requires-Dist: numpy>=2.0
|
|
12
|
+
Requires-Dist: pandas>=2.2
|
|
13
|
+
Requires-Dist: scipy>=1.14
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# MAT-data: Multiple Aspect Trajectory Summarization Modeling (MAT-SG & MAT-SGT)
|
|
17
|
+
|
|
18
|
+
This repository contains the Python implementation for **Multiple Aspect Trajectory Summarization** algorithms. Initially based on Java, the **MAT-SG** (Multiple-Aspect Trajectories based on a spatial Grid) and **MAT-SGT** (Multi-Aspect Trajectories Based on Spatio-Temporal Segmentation) models were rewritten and optimized in object-oriented Python under the **Template Method** design pattern aiming at processing massive data of enriched trajectories.
|
|
19
|
+
|
|
20
|
+
## π Project Overview
|
|
21
|
+
|
|
22
|
+
The central goal of this library is to reduce large volumes of trajectory points while maintaining spatial, temporal, and semantic fidelity through the agglomeration and definition of representative points that carry proportional semantics (e.g., Weather, POI locations, Prices, etc.).
|
|
23
|
+
|
|
24
|
+
The semantic accumulation supports fusion of both **Numerical** variables that generate average scores via median, and **Categorical** variables, preserving the weighted/proportional distribution of values within the consolidated clusters.
|
|
25
|
+
|
|
26
|
+
### π Available Algorithm Patterns
|
|
27
|
+
|
|
28
|
+
There are two fundamental variations of spatial analysis applied to this model. For a complete theoretical foundation, access the [Approaches (MAT-SG vs MAT-SGT)](docs/approaches.md) guide.
|
|
29
|
+
|
|
30
|
+
1. **MAT-SG**: (Multiple-Aspect Trajectories based on a spatial Grid) agglomerates elements limited only to the **Spatial** threshold and grid, and fuses the semantics to generate mathematically calculated representative centroid points, discarding excessive points (`outliers`).
|
|
31
|
+
2. **MAT-SGT**: (Multi-Aspect Trajectories Based on Spatio-Temporal Segmentation) also adds the **Temporal** threshold, partitioning sub-cells that besides being spatially close, also co-exist in the same contiguous time interval partition of the day, grouping sub-intervals that compose time and space (`STI - Spatial-Temporal Intervals`).
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## π Repository Structure and Architecture
|
|
36
|
+
|
|
37
|
+
The repository is architected following clean formal patterns focused on the **Template Method**. For a deep dive into the separation technique, refer to the [Architecture and Inheritance](docs/architecture.md) documentation.
|
|
38
|
+
|
|
39
|
+
### Class Architecture (Template Method)
|
|
40
|
+
|
|
41
|
+
```mermaid
|
|
42
|
+
classDiagram
|
|
43
|
+
%% Core Algorithms (Method)
|
|
44
|
+
class MATSummarize {
|
|
45
|
+
<<abstract>>
|
|
46
|
+
# _trc: float
|
|
47
|
+
# _trv: float
|
|
48
|
+
# _points_in_cell: list
|
|
49
|
+
# _representative_trajectory: MultipleAspectTrajectory
|
|
50
|
+
+ load()
|
|
51
|
+
+ _compute_min_spatial_threshold()
|
|
52
|
+
+ _allocate_points_in_grid()
|
|
53
|
+
+ _fuse_aspects()
|
|
54
|
+
+ _summarize_numerical_aspects()
|
|
55
|
+
+ _summarize_categorical_aspects()
|
|
56
|
+
+ execute() final
|
|
57
|
+
# process_cell_points(points, cell_id) *abstract*
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class MATSGT {
|
|
61
|
+
- _compute_stis(times)
|
|
62
|
+
- _filter_outlier_differences()
|
|
63
|
+
- _create_centroids_from_stis()
|
|
64
|
+
# process_cell_points(points, cell_id) *override*
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class MATSG {
|
|
68
|
+
- _define_ranking_temporal()
|
|
69
|
+
# process_cell_points(points, cell_id) *override*
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
%% Data Enitites (Model)
|
|
73
|
+
class MultipleAspectTrajectory {
|
|
74
|
+
+ str trajectory_id
|
|
75
|
+
+ list pointList
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
class Centroid {
|
|
79
|
+
+ tuple cellReference
|
|
80
|
+
+ STI sti
|
|
81
|
+
+ addAttrValue()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class Point {
|
|
85
|
+
+ float lat
|
|
86
|
+
+ float lon
|
|
87
|
+
+ TemporalAspect time
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class TemporalAspect {
|
|
91
|
+
+ datetime startTime
|
|
92
|
+
+ datetime endTime
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
class AttributeValue {
|
|
96
|
+
+ any value
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
class SemanticAspect {
|
|
100
|
+
+ str name
|
|
101
|
+
+ SemanticType type
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
%% Inheritances and Relationships
|
|
105
|
+
MATSummarize <|-- MATSGT
|
|
106
|
+
MATSummarize <|-- MATSG
|
|
107
|
+
|
|
108
|
+
MATSummarize --> MultipleAspectTrajectory : Populates
|
|
109
|
+
MultipleAspectTrajectory *-- Point : Contains 1..*
|
|
110
|
+
Centroid --|> Point : Extends
|
|
111
|
+
Point --> TemporalAspect : Has
|
|
112
|
+
Centroid *--> TemporalAspect : Has Multiple
|
|
113
|
+
Point *-- AttributeValue : Has Multiple
|
|
114
|
+
AttributeValue --> SemanticAspect : Maps to
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Directory Layout
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
/
|
|
121
|
+
βββ README.md # Entry point project documentation
|
|
122
|
+
βββ docs/ # Extended project documentation (approaches and architecture guides)
|
|
123
|
+
βββ logs/ # Directory reserved for execution streams and debugging
|
|
124
|
+
βββ data/ # Local datasets manipulation
|
|
125
|
+
β βββ input/ # CSV spreadsheet repository for raw modeling
|
|
126
|
+
β βββ output/ # Representative trajectories extracted by the model (.csv)
|
|
127
|
+
βββ method/ # Contains the clustering and summarization methods logic
|
|
128
|
+
β βββ MATSummarize.py # Base Abstract Class (Template Method Pattern)
|
|
129
|
+
β βββ MATSG.py # Subclass applying Spatial heuristics
|
|
130
|
+
β βββ MATSGT.py # Subclass adding partitioning via Time STIs
|
|
131
|
+
β βββ MUITAS.py # Algorithmic univariate scoring calculations
|
|
132
|
+
βββ model/ # Structural and Geometric Models
|
|
133
|
+
β βββ AttributeValue.py# Embedded dictionaries of <Aspect:Value> (e.g., {WEATHER: "CLOUDS"})
|
|
134
|
+
β βββ Centroid.py # Groups Space-Time cuts
|
|
135
|
+
β βββ Point.py # Abstract elements of raw Lat/Lon
|
|
136
|
+
β βββ SemanticAspect.py# Dimensional treatment
|
|
137
|
+
β βββ TemporalAspect.py# Datetime utility wrapper
|
|
138
|
+
β βββ Util.py # Global Euclidean distances and cKDTree mappings
|
|
139
|
+
βββ execution/ # Entry Point and Main Runner
|
|
140
|
+
βββ runner.py # Local script orchestrator
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## π How to Install and Run
|
|
146
|
+
|
|
147
|
+
**Prerequisites**:
|
|
148
|
+
* Python 3.10+
|
|
149
|
+
* Libraries from `requirements.txt` (Ex: `pandas`, `numpy`, `scipy`)
|
|
150
|
+
|
|
151
|
+
**1. Clone and Prepare the Environment**
|
|
152
|
+
```bash
|
|
153
|
+
git clone https://github.com/RepresentantativeMAT/mat-summarization.git
|
|
154
|
+
pip install -r requirements.txt
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**2. Running a Quick Test (`runner.py`)**
|
|
158
|
+
|
|
159
|
+
A mock test environment and base orchestration are prepared in the `execution/` folder. It points the extractions directly to the input and output reciprocals of the `data/` folder.
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
# In execution/runner.py
|
|
163
|
+
from method.MATSGT import MATSGT
|
|
164
|
+
|
|
165
|
+
# 1. Instantiate the class pointing the datasets dynamically
|
|
166
|
+
model_sgt = MATSGT(
|
|
167
|
+
trc=0.25,
|
|
168
|
+
trv=0.25,
|
|
169
|
+
path=os.path.join(INPUT_DIR, 'Running_Example_v5.csv')
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
# 2. Execute the method passing base traits and dump location
|
|
173
|
+
model_sgt.execute(
|
|
174
|
+
lst_categorical_pd=['price'], # columns forced to act as discrete string
|
|
175
|
+
values_null=[-1, -999], # Null/empty values of your raw dataset
|
|
176
|
+
pattern_date_input='?', # Date regex/patterns or ? for default full-day minute format (24h)
|
|
177
|
+
dir=f"{OUTPUT_DIR}/", # Automatic directory resolved by the OS for dump
|
|
178
|
+
file='teste_saida',
|
|
179
|
+
rc=0.25,
|
|
180
|
+
trv=0.25,
|
|
181
|
+
ignore_columns=None
|
|
182
|
+
)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**3. Resulting Output**
|
|
186
|
+
The execution will export the dataset history under a CSV document:
|
|
187
|
+
`teste_saida rc 25 rv 25 - zX.csv`
|
|
188
|
+
|
|
189
|
+
Upon opening it, it will display the list of points condensed numerically and temporally (with dict-like markings for varied attributes such as `{23:20 - 23:30 prop: 0.33}`). The header will detail the Method used, Coverage, and the amount of Reduction executed over the input root sample.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## π οΈ Recent Refactoring Contributions (Changelog)
|
|
194
|
+
|
|
195
|
+
- Architectural migration based purely on base **Classic Python (`snake_case`)** OOP, eliminating legacy Java *camelCase* fragments;
|
|
196
|
+
- Integration of the **Template Method** encapsulation Pattern concentrating inheritance and abstraction in the parent file *`MATSummarize.py`*, reducing redundant code by >50%;
|
|
197
|
+
- Fixed the `Java Skip Indexing` bug, refining the accuracy with what the Outlier Removal Process eliminates (where before they were accidentally spared);
|
|
198
|
+
- 100% reliable adherence to probability normalization to yield a real-mathematical `sum = 1.0`.
|
|
199
|
+
- Removal of Dead Code through scanning (`Vulture` specs).
|
|
200
|
+
|
|
201
|
+
## π Model Authors / Contact
|
|
202
|
+
This research was partially funded by SoBigData++ Project - by Transnational Access (TNA),as well as the European Unionβs Horizon 2020 research and inno-vation programme under GA N. 777695 (EU Project MASTER -Multiple ASpects TrajEctoRy management and analysis), until 2024. In present, the researcher is referenced in **AnΓ‘lise AvanΓ§ada de Dados de TrajetΓ³rias: Uma ferramenta visual para identificaΓ§Γ£o de padrΓ΅es em dados de Mobilidade** project. Developed with academic support and adaptation via IFSUL and original MAT-data repository.
|
|
203
|
+
|
|
204
|
+
For formal and architectural in-depth understanding based on the original research articles, refer to:
|
|
205
|
+
- **MAT-SG ([Springer Link](https://link.springer.com/chapter/10.1007/978-3-031-12423-5_33))**: *Multiple-Aspect Trajectory Summarization based on a spatial Grid*
|
|
206
|
+
- **MAT-SGT ([JIDM](https://journals-sol.sbc.org.br/index.php/jidm/article/view/4110))**: *Multiple-Aspect Trajectory Summarization via Grid and Time*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
nome/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
nome/method/FeatureAggregator.py,sha256=LbuUEFunhC2aLiD3RY4wHU2nYlCLYlzkXj9Nf6k2hhk,3547
|
|
3
|
+
nome/method/MATSG.py,sha256=4AfTZgvA8euZvU6dDGTDzPBt9xWB-wHwR0suhvHdOUc,4013
|
|
4
|
+
nome/method/MATSGT.py,sha256=rm0OKO6N4hugu4VvQMnwR3rdu9XGlklof9ZOBjXqtgs,3638
|
|
5
|
+
nome/method/MATSummarize.py,sha256=M8q6SGCKIVQQ9HnKG_P7TnySdW4VH6JrufOBcVA9UrU,21665
|
|
6
|
+
nome/method/MUITAS.py,sha256=httsdAfk7NZJBGCbqT9xJuhbUlBIewo6X56xGjhnGWg,5947
|
|
7
|
+
nome/method/__init__.py,sha256=sXQEt0Gcu1rt48QYsbAwgh8dUInBzDIh1ZWbhXUoljU,222
|
|
8
|
+
nome/model/Centroid.py,sha256=AhVc-oJ0o8Sy8DFYfntcF_izF8ql8YFwyC_WU-dnoQw,4169
|
|
9
|
+
nome/model/Feature.py,sha256=Ky7lurLMK6TXEnG5N4740H8TpfHLllMSBWNv24tNp04,1064
|
|
10
|
+
nome/model/MultipleAspectTrajectory.py,sha256=l1qYTjMVEiKim5m5jD4BB9BBj-MdEDwbQ9x-edtcFUU,2518
|
|
11
|
+
nome/model/Point.py,sha256=X8T1ak2biNUpnI5vLWaO6FinLS_stqAmIAopeYDz5Xg,5143
|
|
12
|
+
nome/model/STI.py,sha256=3VZSbN1VX9JvTxRbpEkL7r-oKb9pbdOohUoIExkPVRA,2350
|
|
13
|
+
nome/model/SemanticAspect.py,sha256=2BIEfAaeKAV-dWAXpyaBoCQ5mzUkry3eOoDKies6YBA,1398
|
|
14
|
+
nome/model/SemanticType.py,sha256=rMYHqaQBpoD0xTRJiv6Tw9QFthp4uZXEEUgRsIpvJvk,559
|
|
15
|
+
nome/model/TemporalAspect.py,sha256=P3EQJrVJnSJQohEeL3FJYxJ3CtTyRR-_p6FByd9ovYg,2604
|
|
16
|
+
nome/model/Util.py,sha256=uH4XMJWLOFvrw7KUTQEa1kfZZLG6eAor3Py8eikuYEw,1162
|
|
17
|
+
nome/model/__init__.py,sha256=r6nVVTSq-Fp7Jelv9X6ceP-yVuPf0x_3ftlCTmMeMHM,446
|
|
18
|
+
mat_summarize-0.0.1.dist-info/METADATA,sha256=y5QbFcYwXlqxBxCdw8OzcupWdWZZDgZ62Ry-GSdAboY,9622
|
|
19
|
+
mat_summarize-0.0.1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
20
|
+
mat_summarize-0.0.1.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
21
|
+
mat_summarize-0.0.1.dist-info/RECORD,,
|