TimeFeatures 1.0.10__tar.gz → 1.0.11__tar.gz
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.
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/PKG-INFO +1 -1
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/TimeFeatures.egg-info/PKG-INFO +1 -1
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/TimeFeatures.egg-info/SOURCES.txt +2 -2
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/setup.py +1 -1
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/timefeatures/widgets/owsavetodb.py +11 -4
- TimeFeatures-1.0.10/timefeatures/widgets/owtimefeatureconstructor.py → TimeFeatures-1.0.11/timefeatures/widgets/owtimefeaturesconstructor.py +8 -7
- TimeFeatures-1.0.10/timefeatures/widgets/owtfgraphgenerator.py → TimeFeatures-1.0.11/timefeatures/widgets/owvardependencygraph.py +74 -5
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/LICENSE +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/README.md +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/TimeFeatures.egg-info/dependency_links.txt +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/TimeFeatures.egg-info/entry_points.txt +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/TimeFeatures.egg-info/top_level.txt +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/setup.cfg +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/timefeatures/widgets/__init__.py +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/timefeatures/widgets/icons/graphgenerator.svg +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/timefeatures/widgets/icons/savedatadb.svg +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/timefeatures/widgets/icons/timefeature-xs.svg +0 -0
- {TimeFeatures-1.0.10 → TimeFeatures-1.0.11}/timefeatures/widgets/icons/timefeature.svg +0 -0
|
@@ -9,8 +9,8 @@ TimeFeatures.egg-info/entry_points.txt
|
|
|
9
9
|
TimeFeatures.egg-info/top_level.txt
|
|
10
10
|
timefeatures/widgets/__init__.py
|
|
11
11
|
timefeatures/widgets/owsavetodb.py
|
|
12
|
-
timefeatures/widgets/
|
|
13
|
-
timefeatures/widgets/
|
|
12
|
+
timefeatures/widgets/owtimefeaturesconstructor.py
|
|
13
|
+
timefeatures/widgets/owvardependencygraph.py
|
|
14
14
|
timefeatures/widgets/icons/graphgenerator.svg
|
|
15
15
|
timefeatures/widgets/icons/savedatadb.svg
|
|
16
16
|
timefeatures/widgets/icons/timefeature-xs.svg
|
|
@@ -21,7 +21,7 @@ setup(name="TimeFeatures",
|
|
|
21
21
|
packages=["timefeatures.widgets"],
|
|
22
22
|
package_data={"timefeatures.widgets": ["icons/*.svg", "icons/*.png"]},
|
|
23
23
|
entry_points={"orange.widgets": "Time-Features = timefeatures.widgets"},
|
|
24
|
-
version="1.0.
|
|
24
|
+
version="1.0.11",
|
|
25
25
|
author="Alejandro Rivas García",
|
|
26
26
|
author_email="alejandrorivasgarcia@gmail.com",
|
|
27
27
|
keywords=[
|
|
@@ -46,7 +46,7 @@ class owsavetodb(OWBaseSql, OWWidget):
|
|
|
46
46
|
name = "Save to DB"
|
|
47
47
|
description = "Save a dataset into a DB."
|
|
48
48
|
icon = "icons/savedatadb.svg"
|
|
49
|
-
priority =
|
|
49
|
+
priority = 2241
|
|
50
50
|
keywords = "sql table, save, data, db, dataset"
|
|
51
51
|
|
|
52
52
|
class Inputs:
|
|
@@ -169,7 +169,8 @@ class owsavetodb(OWBaseSql, OWWidget):
|
|
|
169
169
|
datetime TIMESTAMP NOT NULL,
|
|
170
170
|
rows INT NOT NULL,
|
|
171
171
|
cols INT NOT NULL,
|
|
172
|
-
class VARCHAR(30)
|
|
172
|
+
class VARCHAR(30),
|
|
173
|
+
class_name VARCHAR(30)
|
|
173
174
|
)
|
|
174
175
|
"""
|
|
175
176
|
try:
|
|
@@ -257,9 +258,15 @@ class owsavetodb(OWBaseSql, OWWidget):
|
|
|
257
258
|
self.Error.connection("Host and database fields must be filled.")
|
|
258
259
|
else:
|
|
259
260
|
self.create_master_table()
|
|
260
|
-
|
|
261
|
+
|
|
262
|
+
if self.data.domain.class_var:
|
|
263
|
+
class_name = self.data.domain.class_var.name
|
|
264
|
+
else:
|
|
265
|
+
class_name = None
|
|
266
|
+
|
|
267
|
+
query = "INSERT INTO public.datasets (name, datetime, rows, cols, class, class_name) VALUES ('" + self.tableName.text().lower() + "','" + datetime.now().strftime(
|
|
261
268
|
'%Y-%m-%d %H:%M:%S') + "','" + str(self.rows) + "','" + str(self.cols) + "','" + str(
|
|
262
|
-
self.target) + "');"
|
|
269
|
+
self.target) + "','" + str(class_name) + "');"
|
|
263
270
|
|
|
264
271
|
try:
|
|
265
272
|
with self.backend.execute_sql_query(query):
|
|
@@ -809,20 +809,20 @@ class FeatureConstructorHandler(DomainContextHandler):
|
|
|
809
809
|
return True
|
|
810
810
|
|
|
811
811
|
|
|
812
|
-
class
|
|
813
|
-
name = "Time
|
|
812
|
+
class owtimefeaturesconstructor(OWWidget, ConcurrentWidgetMixin):
|
|
813
|
+
name = "Time Features Constructor"
|
|
814
814
|
description = "Construct new time features (data columns) from a set of " \
|
|
815
815
|
"existing features in the input dataset."
|
|
816
816
|
icon = "icons/timefeature.svg"
|
|
817
|
-
keywords = "time
|
|
818
|
-
priority =
|
|
817
|
+
keywords = "time features constructor, function, time, constructor, features"
|
|
818
|
+
priority = 2239
|
|
819
819
|
|
|
820
820
|
class Inputs:
|
|
821
821
|
data = Input("Data", Orange.data.Table)
|
|
822
822
|
|
|
823
823
|
class Outputs:
|
|
824
824
|
data = Output("Data", Orange.data.Table)
|
|
825
|
-
expressions = Output("
|
|
825
|
+
expressions = Output("Variable Definitions", Orange.data.Table)
|
|
826
826
|
|
|
827
827
|
want_main_area = False
|
|
828
828
|
|
|
@@ -847,11 +847,13 @@ class owtimefeatureconstructor(OWWidget, ConcurrentWidgetMixin):
|
|
|
847
847
|
class Warning(OWWidget.Warning):
|
|
848
848
|
renamed_var = Msg("Recently added variable has been renamed, "
|
|
849
849
|
"to avoid duplicates.\n")
|
|
850
|
+
table_warning = Msg("You need a configuration table (Variable-Expression).")
|
|
850
851
|
|
|
851
852
|
def __init__(self):
|
|
852
853
|
super().__init__()
|
|
853
854
|
ConcurrentWidgetMixin.__init__(self)
|
|
854
855
|
self.data = None
|
|
856
|
+
self.expressions = None
|
|
855
857
|
self.dataOriginal = None
|
|
856
858
|
self.editors = {}
|
|
857
859
|
|
|
@@ -1022,7 +1024,6 @@ class owtimefeatureconstructor(OWWidget, ConcurrentWidgetMixin):
|
|
|
1022
1024
|
|
|
1023
1025
|
self.apply()
|
|
1024
1026
|
|
|
1025
|
-
|
|
1026
1027
|
def _on_selectedVariableChanged(self, selected, *_):
|
|
1027
1028
|
index = selected_row(self.featureview)
|
|
1028
1029
|
if index is not None:
|
|
@@ -1814,4 +1815,4 @@ class FeatureFunc:
|
|
|
1814
1815
|
|
|
1815
1816
|
|
|
1816
1817
|
if __name__ == "__main__": # pragma: no cover
|
|
1817
|
-
WidgetPreview(
|
|
1818
|
+
WidgetPreview(owtimefeaturesconstructor).run(Orange.data.Table("iris"))
|
|
@@ -17,6 +17,68 @@ from PyQt5.QtWidgets import QPushButton, QVBoxLayout, QHBoxLayout
|
|
|
17
17
|
from orangecontrib.network import Network
|
|
18
18
|
from orangewidget.utils.signals import Input
|
|
19
19
|
|
|
20
|
+
'''def calculate_weight(expression):
|
|
21
|
+
# Encontrar todas las coincidencias con las funciones temporales y almacenarlas
|
|
22
|
+
matches_shift = list(re.finditer(r'shift\(([^,]+),([-+]?\d+)\)', expression))
|
|
23
|
+
matches_sum = list(re.finditer(r'sum\(([^,]+),([-+]?\d+),([-+]?\d+)\)', expression))
|
|
24
|
+
matches_mean = list(re.finditer(r'mean\(([^,]+),([-+]?\d+),([-+]?\d+)\)', expression))
|
|
25
|
+
matches_count = list(re.finditer(r'count\(([^,]+),([-+]?\d+),([-+]?\d+)\)', expression))
|
|
26
|
+
matches_min = list(re.finditer(r'min\(([^,]+),([-+]?\d+),([-+]?\d+)\)', expression))
|
|
27
|
+
matches_max = list(re.finditer(r'max\(([^,]+),([-+]?\d+),([-+]?\d+)\)', expression))
|
|
28
|
+
matches_sd = list(re.finditer(r'sd\(([^,]+),([-+]?\d+),([-+]?\d+)\)', expression))
|
|
29
|
+
|
|
30
|
+
valores = {}
|
|
31
|
+
|
|
32
|
+
# Iterar sobre todas las coincidencias de shift y cambiar la expresión
|
|
33
|
+
for match in matches_shift:
|
|
34
|
+
variable_name = match.group(1)
|
|
35
|
+
shift_value = match.group(2)
|
|
36
|
+
|
|
37
|
+
valores[variable_name] = -abs(int(shift_value))
|
|
38
|
+
|
|
39
|
+
for match in matches_sum:
|
|
40
|
+
variable_name = match.group(1)
|
|
41
|
+
sum_value1 = match.group(2)
|
|
42
|
+
sum_value2 = match.group(3)
|
|
43
|
+
|
|
44
|
+
valores[variable_name] = -max(abs(int(sum_value1)), abs(int(sum_value2)))
|
|
45
|
+
|
|
46
|
+
for match in matches_mean:
|
|
47
|
+
variable_name = match.group(1)
|
|
48
|
+
mean_value1 = match.group(2)
|
|
49
|
+
mean_value2 = match.group(3)
|
|
50
|
+
|
|
51
|
+
valores[variable_name] = -max(abs(int(mean_value1)), abs(int(mean_value2)))
|
|
52
|
+
|
|
53
|
+
for match in matches_count:
|
|
54
|
+
variable_name = match.group(1)
|
|
55
|
+
count_value1 = match.group(2)
|
|
56
|
+
count_value2 = match.group(3)
|
|
57
|
+
|
|
58
|
+
valores[variable_name] = -max(abs(int(count_value1)), abs(int(count_value2)))
|
|
59
|
+
|
|
60
|
+
for match in matches_min:
|
|
61
|
+
variable_name = match.group(1)
|
|
62
|
+
min_value1 = match.group(2)
|
|
63
|
+
min_value2 = match.group(3)
|
|
64
|
+
|
|
65
|
+
valores[variable_name] = -max(abs(int(min_value1)), abs(int(min_value2)))
|
|
66
|
+
|
|
67
|
+
for match in matches_max:
|
|
68
|
+
variable_name = match.group(1)
|
|
69
|
+
max_value1 = match.group(2)
|
|
70
|
+
max_value2 = match.group(3)
|
|
71
|
+
|
|
72
|
+
valores[variable_name] = -max(abs(int(max_value1)), abs(int(max_value2)))
|
|
73
|
+
|
|
74
|
+
for match in matches_sd:
|
|
75
|
+
variable_name = match.group(1)
|
|
76
|
+
sd_value1 = match.group(2)
|
|
77
|
+
sd_value2 = match.group(3)
|
|
78
|
+
|
|
79
|
+
valores[variable_name] = -max(abs(int(sd_value1)), abs(int(sd_value2)))
|
|
80
|
+
|
|
81
|
+
return valores.values()'''
|
|
20
82
|
|
|
21
83
|
def from_row_col(f):
|
|
22
84
|
@wraps(f)
|
|
@@ -34,12 +96,16 @@ def from_row_col(f):
|
|
|
34
96
|
expresion_regular = r'\b(' + '|'.join(map(re.escape, variables)) + r')\b'
|
|
35
97
|
|
|
36
98
|
relaciones = {}
|
|
99
|
+
# edge_weights = []
|
|
37
100
|
|
|
38
101
|
for datos in data:
|
|
39
102
|
variable = str(datos[0])
|
|
40
103
|
variable = variable.replace(" ", "_").replace("-", "_")
|
|
41
104
|
if not math.isnan(datos[1]) and str(datos[1]) != "NaN":
|
|
42
105
|
tipo_var.append(0)
|
|
106
|
+
# edge_weights_exp = calculate_weight(str(datos[1]))
|
|
107
|
+
# for weight in edge_weights_exp:
|
|
108
|
+
# edge_weights.append(int(weight))
|
|
43
109
|
else:
|
|
44
110
|
tipo_var.append(1)
|
|
45
111
|
relaciones[variable] = []
|
|
@@ -63,7 +129,10 @@ def from_row_col(f):
|
|
|
63
129
|
|
|
64
130
|
tipo_var_reshaped = np.array(tipo_var).reshape(-1, 1)
|
|
65
131
|
|
|
132
|
+
# np_edge_weights = np.array(edge_weights)
|
|
133
|
+
|
|
66
134
|
n = len(relaciones)
|
|
135
|
+
# edges = sp.csr_matrix((np_edge_weights, (row_edges, col_edges)), shape=(n, n))
|
|
67
136
|
edges = sp.csr_matrix((np.ones(len(row_edges)), (row_edges, col_edges)), shape=(n, n))
|
|
68
137
|
return Network(range(n), edges, name=f"{f.__name__}{args}"), nombres_variables, tipo_var_reshaped
|
|
69
138
|
|
|
@@ -75,11 +144,11 @@ def grafo(data=None):
|
|
|
75
144
|
return data
|
|
76
145
|
|
|
77
146
|
|
|
78
|
-
class
|
|
79
|
-
name = "
|
|
147
|
+
class owvardependencygraph(OWWidget, ConcurrentWidgetMixin):
|
|
148
|
+
name = "Variable Dependency Graph"
|
|
80
149
|
description = "Construct a graph with all the conexions between the variables"
|
|
81
150
|
icon = "icons/graphgenerator.svg"
|
|
82
|
-
keywords = "
|
|
151
|
+
keywords = "variable dependency graph, function, graph, dependency, variable"
|
|
83
152
|
priority = 2240
|
|
84
153
|
|
|
85
154
|
GRAPH_TYPES = (
|
|
@@ -97,7 +166,7 @@ class owtfgraphgenerator(OWWidget, ConcurrentWidgetMixin):
|
|
|
97
166
|
generation_error = Msg("{}")
|
|
98
167
|
|
|
99
168
|
class Inputs:
|
|
100
|
-
data = Input("
|
|
169
|
+
data = Input("Variable Definitions", Orange.data.Table)
|
|
101
170
|
|
|
102
171
|
class Outputs:
|
|
103
172
|
network = Output("Network", Network)
|
|
@@ -120,7 +189,7 @@ class owtfgraphgenerator(OWWidget, ConcurrentWidgetMixin):
|
|
|
120
189
|
buttonlayout.setContentsMargins(0, 0, 0, 0)
|
|
121
190
|
|
|
122
191
|
self.btn_generate = QPushButton(
|
|
123
|
-
"
|
|
192
|
+
"Generate", toolTip="Generate dependency graph.",
|
|
124
193
|
minimumWidth=10
|
|
125
194
|
)
|
|
126
195
|
self.btn_generate.clicked.connect(self.generate)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|