SoilID: Fix component-group selection being sorted alphabetically instead of by cond_prob
@johannesparty ci sta già lavorando.
Dal 24/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Summary
process_distance_scores sorts component-instance rows by descending cond_prob, but then groups them with sort=True. This reorders the groups alphabetically by compname before selecting the first 12 groups, so the function can discard high-probability component groups and retain lower-probability groups solely because their names sort earlier.
Location
soil_id/utils.py, in process_distance_scores:
mucompdata_pd = mucompdata_pd.sort_values(
["cond_prob", comp_name_col], ascending=[False, True]
)
mucompdata_comp_grps = [
g for _, g in mucompdata_pd.groupby([comp_name_col], sort=True)
]
mucompdata_comp_grps = mucompdata_comp_grps[: min(12, len(mucompdata_comp_grps))]
Expected behavior
The selected 12 component groups should be the groups with the highest cond_prob values, preserving the ranking established before grouping.
Actual behavior
sort=True orders the groups by the component name key. Consequently, mucompdata_comp_grps[:12] selects the first 12 groups alphabetically rather than the 12 highest-ranked groups.
Proposed fix
Use sort=False so pandas yields groups in first-appearance order, which follows the preceding cond_prob descending sort:
mucompdata_comp_grps = [
g for _, g in mucompdata_pd.groupby([comp_name_col], sort=False)
]
Add or update regression tests to verify that the retained groups are the highest-probability component groups, not the alphabetically first groups.
Related issue in the same block
The loop below reassigns and modifies only a local group variable, so its distance sort and min_dist assignment are not reflected in mucompdata_comp_grps or the final concatenated DataFrame:
for group in mucompdata_comp_grps:
group = group.sort_values(distance_col).reset_index(drop=True)
group["min_dist"] = group[distance_col].iloc[0]
The implementation should also preserve those intended modifications, for example by assigning the transformed groups back into the list. This should be covered by tests or handled as part of the fix if it is within scope.
@johannesparty regarding our conversation today, we originally truncated the number of soil series (compname) to 12 in the old app due to display issues. It probably makes sense to remove this constraint because, in the US case, many 1000m buffers can contain more than 12 soils.
- Lingua principale
- Python
- Stelle
- 2
- Fork
- 3
- Merge medio
- 4g 13h
- PR unite (30g)
- 6
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di techmatters/soil-id-algorithm
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
techmatters/soil-id-algorithm#386 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
techmatters/soil-id-algorithm#390 · 1 commento ·
-
Design: a slice informed by fewer properties counts as much per cm as a fully-populated sliceAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
techmatters/soil-id-algorithm#388 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
techmatters/soil-id-algorithm#387 ·
-
soil_sim: divide-by-zero in ilr/clr when a particle fraction is 0 (simulation/confidence metric)Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
techmatters/soil-id-algorithm#385 ·
Tutte le issue di techmatters/soil-id-algorithm
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anchore/grype-db#1149 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `hermes plugins update` clones an entire monorepo twice - `subdir` is resolved but dropped at both catalog-update call sitesForse già presa @HootRock l’ha presa oggi. Apertacomp/cli P2 type/perf
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NousResearch/hermes-agent#142417 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
SMC SPEC
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
tenstorrent/tt-oca-harness#3287 ·
I maintainer di solito rispondono entro 1 giorno
-
bug enhancement python
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DewaldOosthuizen/tech-cheat-sheets-and-notes#392 ·
I maintainer di solito rispondono entro 1 giorno
-
Critical advisories on mainApertasecurity
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
fabriziosalmi/wildbox#801 ·
I maintainer di solito rispondono entro 1 giorno