Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.

Commit 1692e16

Browse files
committed
removed label parameter from default cluster estimation
1 parent 2106bbe commit 1692e16

File tree

5 files changed

+7
-38
lines changed

5 files changed

+7
-38
lines changed

main_2024.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ def main() -> int:
346346
MIN_NEW_POINTS_TO_RUN,
347347
MAX_NUM_COMPONENTS,
348348
RANDOM_STATE,
349-
0,
350349
),
351350
input_queues=[geolocation_to_cluster_estimation_queue],
352351
output_queues=[cluster_estimation_to_communications_queue],

modules/cluster_estimation/cluster_estimation.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
# pylint: disable=duplicate-code
88

9-
# pylint: disable=duplicate-code
10-
119
import numpy as np
1210
import sklearn
1311
import sklearn.datasets
@@ -38,9 +36,6 @@ class ClusterEstimation:
3836
local_logger: Logger
3937
For logging error and debug messages.
4038
41-
label: int
42-
Every cluster generated by this model will have this label
43-
4439
METHODS
4540
-------
4641
run()
@@ -88,7 +83,6 @@ def create(
8883
max_num_components: int,
8984
random_state: int,
9085
local_logger: logger.Logger,
91-
label: int,
9286
) -> "tuple[bool, ClusterEstimation | None]":
9387
"""
9488
Data requirement conditions for estimation model to run.
@@ -130,7 +124,6 @@ def create(
130124
max_num_components,
131125
random_state,
132126
local_logger,
133-
label,
134127
)
135128

136129
def __init__(
@@ -141,7 +134,6 @@ def __init__(
141134
max_num_components: int,
142135
random_state: int,
143136
local_logger: logger.Logger,
144-
label: int,
145137
) -> None:
146138
"""
147139
Private constructor, use create() method.
@@ -168,7 +160,6 @@ def __init__(
168160
self.__min_new_points_to_run = min_new_points_to_run
169161
self.__has_ran_once = False
170162
self.__logger = local_logger
171-
self.__label = label
172163

173164
def run(
174165
self, detections: "list[detection_in_world.DetectionInWorld]", run_override: bool
@@ -196,6 +187,10 @@ def run(
196187
List containing ObjectInWorld objects, containing position and covariance value.
197188
None if conditions not met and model not ran or model failed to converge.
198189
"""
190+
# in use, all detections will have the same label, so the
191+
# first element's label was arbitrarily selected
192+
label = detections[0].label
193+
199194
# Store new input data
200195
self.__current_bucket += self.__convert_detections_to_point(detections)
201196

@@ -228,6 +223,7 @@ def run(
228223

229224
# Filter out all clusters after __WEIGHT_DROP_THRESHOLD weight drop occurs
230225
viable_clusters = [model_output[0]]
226+
print(f"len(model_output) = {len(model_output)}")
231227
for i in range(1, len(model_output)):
232228
if model_output[i][1] / model_output[i - 1][1] < self.__WEIGHT_DROP_THRESHOLD:
233229
break
@@ -243,7 +239,7 @@ def run(
243239
objects_in_world = []
244240
for cluster in model_output:
245241
result, landing_pad = object_in_world.ObjectInWorld.create(
246-
cluster[0][0], cluster[0][1], cluster[2], self.__label
242+
cluster[0][0], cluster[0][1], cluster[2], label
247243
)
248244

249245
if result:

modules/cluster_estimation/cluster_estimation_by_label.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ def run(
153153
self.__max_num_components,
154154
self.__random_state,
155155
self.__local_logger,
156-
label,
157156
)
158157
if not result:
159158
self.__local_logger.error(

modules/cluster_estimation/cluster_estimation_worker.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def cluster_estimation_worker(
1919
min_new_points_to_run: int,
2020
max_num_components: int,
2121
random_state: int,
22-
label: int,
2322
input_queue: queue_proxy_wrapper.QueueProxyWrapper,
2423
output_queue: queue_proxy_wrapper.QueueProxyWrapper,
2524
controller: worker_controller.WorkerController,
@@ -76,7 +75,6 @@ def cluster_estimation_worker(
7675
max_num_components,
7776
random_state,
7877
local_logger,
79-
label,
8078
)
8179
if not result:
8280
local_logger.error("Worker failed to create class object", True)

tests/unit/test_cluster_detection.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# Test functions use test fixture signature names and access class privates
2323
# No enable
24-
# pylint: disable=protected-access,redefined-outer-name
24+
# pylint: disable=protected-access,redefined-outer-name,too-many-instance-attributes
2525

2626

2727
@pytest.fixture()
@@ -39,7 +39,6 @@ def cluster_model() -> cluster_estimation.ClusterEstimation: # type: ignore
3939
MAX_NUM_COMPONENTS,
4040
RNG_SEED,
4141
test_logger,
42-
0
4342
)
4443
assert result
4544
assert model is not None
@@ -62,28 +61,6 @@ def cluster_model_by_label() -> cluster_estimation_by_label.ClusterEstimationByL
6261
MAX_NUM_COMPONENTS,
6362
RNG_SEED,
6463
test_logger,
65-
0
66-
)
67-
assert result
68-
assert model is not None
69-
70-
yield model # type: ignore
71-
72-
73-
@pytest.fixture()
74-
def cluster_model_by_label() -> cluster_estimation_by_label.ClusterEstimationByLabel: # type: ignore
75-
"""
76-
Cluster estimation by label object.
77-
"""
78-
result, test_logger = logger.Logger.create("test_logger", False)
79-
assert result
80-
assert test_logger is not None
81-
82-
result, model = cluster_estimation_by_label.ClusterEstimationByLabel.create(
83-
MIN_TOTAL_POINTS_THRESHOLD,
84-
MIN_NEW_POINTS_TO_RUN,
85-
RNG_SEED,
86-
test_logger,
8764
)
8865
assert result
8966
assert model is not None

0 commit comments

Comments
 (0)