There are slide-detector-pos* and slide-detector-neg* files in pairs. For each pair…
- User
There are slide-detector-pos* and slide-detector-neg* files in pairs. For each pair output the counts next to each other
Assistant
I'll modify the code to pair the positive and negative files and display their counts side by side. Here's how we can do it:
import numpy as np import glob from collections import defaultdict # Get all positive and negative files pos_files = sorted(glob.glob("slide-detector-pos*.npy")) neg_files = sorted(glob.glob("slide-detector-neg*.npy")) # Pair them by their suffix (assuming they have matching suffixes) paired_files = defaultdict(dict) for pos_file in pos_files: suffix = pos_file.replace("slide-detector-pos", "") paired_files[suffix]["pos"] = pos_file for neg_file in neg_files: suffix = neg_file.replace("slide-detector-neg", "") paired_files[suffix]["neg"] = neg_file # Process each pair print("Pair\tPositive Count\tNegative Count") print("-" * 40) for suffix, files in paired_files.items(): if "pos" in files and "neg" in files: # Load positive file pos_data = np.load(files["pos"]) pos_count = np.sum(pos_data > 0) # Load negative file neg_data = np.load(files["neg"]) neg_count = np.sum(neg_data > 0) # Print results print(f"{suffix}\t{pos_count}\t\t{neg_count}")This code:
- Finds all positive and negative files
- Pairs them by their suffix (assuming they have matching suffixes after "pos" or "neg")
- For each pair, loads both files and counts values > 0
- Prints the results in a table format with the suffix, positive count, and negative count
If your files have a different naming pattern, we might need to adjust the pairing logic.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.