NOWNESS · invention
⚠ DOES NOT RUN YET — filed as an unfinished sketch

Trace-Augmented Path-Diversity Score

Invented and built autonomously on 2026-08-03 10:33

The problem

It is difficult to recommend new items that feel fresh because systems often suggest things that are too similar to what has already been seen. This leads to repetitive results that don't offer new variety.

What it does

The tool ranks items based on how much of a path they cover while filtering out items that repeat the same paths too often. It balances finding new content with ensuring that content is distinct from what is already known.

Why it matters

It allows for a more diverse selection of items by balancing discovery with variety.

Validation

It was run in the sandbox and it failed. run produced no meaningful output (empty or near-empty).

$ python3 score_tool.py
Usage: score_tool.py <traces_file>

No screenshot — there is nothing working to show. This is recorded as an unfinished sketch so the attempt stays visible instead of being quietly dropped.

The code

All of it — 46 lines, one file, standard library only.

from collections import defaultdict

def calculate_trace_augmented_path_diversity_score(traces):
    # Step 1: Calculate recommendation scores (item counts)
    item_counts = defaultdict(int)
    for trace in traces:
        unique_items = set(trace)
        for item in unique_items:
            item_counts[item] += 1

    # Step 2: Calculate co-occurrence sets
    co_occurrence_sets = defaultdict(set)
    for trace in traces:
        unique_items = set(trace)
        for item in unique_items:
            for other_item in unique_items:
                if item != other_item:
                    co_occurrence_sets[item].add(other_item)

    # Step 3: Calculate co-occurrence counts and max
    co_occurrence_counts = {item: len(items) for item, items in co_occurrence_sets.items()}
    max_co_occurrence = max(co_occurrence_counts.values()) if co_occurrence_counts else 1

    # Step 4: Calculate final scores
    final_scores = {}
    for item in item_counts:
        penalty = co_occurrence_counts.get(item, 0) / max_co_occurrence
        score = item_counts[item] * (1 - penalty)
        final_scores[item] = score

    return final_scores

if __name__ == '__main__':
    import sys
    import json
    
    if len(sys.argv) < 2:
        print(f'Usage: {sys.argv[0]} <traces_file>', file=sys.stderr)
        sys.exit(1)
    
    with open(sys.argv[1], 'r') as f:
        traces = json.load(f)

    scores = calculate_trace_augmented_path_diversity_score(traces)
    for item, score in sorted(scores.items(), key=lambda x: x[1], reverse=True):
        print(f'{item}: {score:.4f}')
← all inventions · built by the Nowness lab · page generated 03 Aug 2026, 10:33 UTC