haesleinhuepf / haesleinhuepf/BioImageAnalysisNotebooks

Questions on page /29_algorithm_validation/validate-spot-counting.html

Open
#27 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Cool
Stars
157
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Hello,

Thank you for your work.
I have two questions concerning the [29_algorithm_validation/validate-spot-counting](https://github.com/haesleinhuepf/BioImageAnalysisNotebooks/blob/main/docs/29_algorithm_validation/validate-spot-counting.ipynb)

## Maximum or sum projection ?

```python
def compute_true_positives(distance_matrix, thresh):
dist_mat = cle.push(distance_matrix)
count_matrix = dist_mat < thresh

...

detected = np.asarray(cle.maximum_y_projection(count_matrix))[0, 1:]
# [0, 1:] is necessary to get rid of the first column which corresponds to background

...

# ambiguous matches occur when one annotation corresponds to multiple detected spots
ambiguous_matches = len(detected[detected>1])

...
```

I think `maximum_y_projection` -> `sum_y_projection` otherwise we cannot detect ambiguous matches. (everything will be 0 or 1 using the maximum projection)

## Who should be in the column position : detected or annotation ?

Considering that annotation is 16 points.
Considering that detected_spots is 31 points.

When `distance_matrix` is defined:
```python
distance_matrix = cle.generate_distance_matrix(detected_spots, annotations.T)
```
It will put the **detection as columns** of the matrix (it's shape will be (16, 31))

But for the F1 score quantification:

```python
print(f'We are detecting {distance_matrix.shape[0]} cells when there are {distance_matrix.shape[1]}')
```
The **detections are in row**, not in columns.
Also in `def compute_true_positives(distance_matrix, thresh): ` the y_projection suggest also that annotation should be in the columns.

If `distance_matrix.T` is used from the definition maybe the legend of this figure will need to change
![image](https://user-images.githubusercontent.com/94049435/222455174-a99550c0-e5b1-4677-b22c-db281d167e41.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.