claude-evolve 1.2.10 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/claude-evolve-analyze +133 -31
- package/package.json +1 -1
|
@@ -163,15 +163,21 @@ while IFS=, read -r id _ desc perf status; do
|
|
|
163
163
|
done <"$csv_file"
|
|
164
164
|
|
|
165
165
|
# Process generation stats
|
|
166
|
-
for gen in $(cut -d' ' -f1 "$gen_stats_file" | sort -u); do
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
for gen in $(cut -d' ' -f1 "$gen_stats_file" | sort -u || echo ""); do
|
|
167
|
+
[[ -z "$gen" ]] && continue
|
|
168
|
+
total_in_gen=$(grep -c "^$gen " "$gen_stats_file" 2>/dev/null || echo "0")
|
|
169
|
+
completed_in_gen=$(grep -c "^$gen completed" "$gen_stats_file" 2>/dev/null || echo "0")
|
|
170
|
+
# Clean any whitespace from the numbers
|
|
171
|
+
completed_in_gen=$(echo "$completed_in_gen" | tr -d '[:space:]')
|
|
169
172
|
|
|
170
173
|
echo -n "$gen: $total_in_gen candidates"
|
|
171
174
|
|
|
172
|
-
if [[ $completed_in_gen -gt 0 ]]; then
|
|
173
|
-
# Calculate average performance for this generation
|
|
174
|
-
sum
|
|
175
|
+
if [[ "$completed_in_gen" -gt 0 ]]; then
|
|
176
|
+
# Calculate average performance for this generation
|
|
177
|
+
sum="0"
|
|
178
|
+
if grep -q "^$gen completed" "$gen_stats_file"; then
|
|
179
|
+
sum=$(grep "^$gen completed" "$gen_stats_file" | awk '{s+=$3} END {printf "%.6f", s}' 2>/dev/null || echo "0")
|
|
180
|
+
fi
|
|
175
181
|
avg=$(echo "scale=4; $sum / $completed_in_gen" | bc -l 2>/dev/null || echo "0")
|
|
176
182
|
echo " ($completed_in_gen completed, avg: $avg)"
|
|
177
183
|
else
|
|
@@ -181,16 +187,52 @@ done
|
|
|
181
187
|
|
|
182
188
|
rm -f "$gen_stats_file"
|
|
183
189
|
|
|
190
|
+
# Count valid performance entries for chart (excluding zeros)
|
|
191
|
+
valid_performance_count=0
|
|
192
|
+
while IFS=, read -r id _ desc perf status; do
|
|
193
|
+
[[ $id == "id" ]] && continue # Skip header
|
|
194
|
+
if [[ $status =~ ^(complete|completed)$ && -n $perf && $perf != "" ]]; then
|
|
195
|
+
if (( $(echo "$perf > 0" | bc -l 2>/dev/null || echo "0") )); then
|
|
196
|
+
((valid_performance_count++))
|
|
197
|
+
fi
|
|
198
|
+
fi
|
|
199
|
+
done <"$csv_file"
|
|
200
|
+
|
|
184
201
|
# Simple chart generation using gnuplot if available
|
|
185
|
-
if command -v gnuplot >/dev/null 2>&1 && [[ $
|
|
202
|
+
if command -v gnuplot >/dev/null 2>&1 && [[ $valid_performance_count -gt 0 ]]; then
|
|
186
203
|
echo
|
|
187
204
|
echo "Generating performance chart: $output_file"
|
|
188
205
|
|
|
189
|
-
# Create data
|
|
206
|
+
# Create data files for gnuplot
|
|
190
207
|
data_file="/tmp/evolution_data_$$.dat"
|
|
191
208
|
winner_file="/tmp/evolution_winner_$$.dat"
|
|
192
|
-
|
|
193
|
-
|
|
209
|
+
gen_avg_file="/tmp/evolution_gen_avg_$$.dat"
|
|
210
|
+
|
|
211
|
+
echo "# Row ID Performance Generation" >"$data_file"
|
|
212
|
+
echo "# Generation AvgPerformance Color" >"$gen_avg_file"
|
|
213
|
+
|
|
214
|
+
# Get color by generation number
|
|
215
|
+
get_gen_color() {
|
|
216
|
+
local gen_num="$1"
|
|
217
|
+
case $gen_num in
|
|
218
|
+
1) echo "#1f77b4" ;; # blue
|
|
219
|
+
2) echo "#ff7f0e" ;; # orange
|
|
220
|
+
3) echo "#2ca02c" ;; # green
|
|
221
|
+
4) echo "#d62728" ;; # red
|
|
222
|
+
5) echo "#9467bd" ;; # purple
|
|
223
|
+
6) echo "#8c564b" ;; # brown
|
|
224
|
+
7) echo "#e377c2" ;; # pink
|
|
225
|
+
8) echo "#7f7f7f" ;; # gray
|
|
226
|
+
9) echo "#bcbd22" ;; # olive
|
|
227
|
+
10) echo "#17becf" ;; # cyan
|
|
228
|
+
*) echo "#cccccc" ;; # default gray
|
|
229
|
+
esac
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
# Create temporary files for generation tracking
|
|
233
|
+
gen_data_temp="/tmp/evolution_gen_temp_$$.dat"
|
|
234
|
+
>"$gen_data_temp"
|
|
235
|
+
|
|
194
236
|
row_num=0
|
|
195
237
|
max_perf=0
|
|
196
238
|
max_row=0
|
|
@@ -200,11 +242,26 @@ if command -v gnuplot >/dev/null 2>&1 && [[ $count_with_performance -gt 0 ]]; th
|
|
|
200
242
|
[[ $id == "id" ]] && continue # Skip header
|
|
201
243
|
((row_num++))
|
|
202
244
|
|
|
245
|
+
# Extract generation from ID
|
|
246
|
+
gen="gen01" # default
|
|
247
|
+
if [[ $id =~ ^(gen[0-9]+)- ]]; then
|
|
248
|
+
gen="${BASH_REMATCH[1]}"
|
|
249
|
+
fi
|
|
250
|
+
|
|
203
251
|
# Only include completed algorithms with non-zero performance
|
|
204
252
|
if [[ -n $perf && $perf != "" && $status =~ ^(complete|completed)$ ]]; then
|
|
205
253
|
# Skip zero values (they're errors)
|
|
206
254
|
if (( $(echo "$perf > 0" | bc -l) )); then
|
|
207
|
-
|
|
255
|
+
# Assign generation number for coloring (1-based)
|
|
256
|
+
gen_num=1
|
|
257
|
+
if [[ $id =~ ^gen([0-9]+)- ]]; then
|
|
258
|
+
gen_num=$((10#${BASH_REMATCH[1]}))
|
|
259
|
+
fi
|
|
260
|
+
|
|
261
|
+
echo "$row_num \"$id\" $perf $gen_num" >>"$data_file"
|
|
262
|
+
|
|
263
|
+
# Track for generation averages
|
|
264
|
+
echo "$gen $perf" >>"$gen_data_temp"
|
|
208
265
|
|
|
209
266
|
# Track the winner
|
|
210
267
|
if (( $(echo "$perf > $max_perf" | bc -l) )); then
|
|
@@ -216,35 +273,80 @@ if command -v gnuplot >/dev/null 2>&1 && [[ $count_with_performance -gt 0 ]]; th
|
|
|
216
273
|
fi
|
|
217
274
|
done <"$csv_file"
|
|
218
275
|
|
|
276
|
+
# Create generation averages file
|
|
277
|
+
gen_index=1
|
|
278
|
+
for gen in $(cut -d' ' -f1 "$gen_data_temp" | sort -u); do
|
|
279
|
+
if grep -q "^$gen " "$gen_data_temp"; then
|
|
280
|
+
# Calculate average for this generation
|
|
281
|
+
sum=$(grep "^$gen " "$gen_data_temp" | awk '{s+=$2} END {printf "%.6f", s}' 2>/dev/null || echo "0")
|
|
282
|
+
count=$(grep -c "^$gen " "$gen_data_temp")
|
|
283
|
+
if [[ $count -gt 0 ]]; then
|
|
284
|
+
avg=$(echo "scale=4; $sum / $count" | bc -l 2>/dev/null || echo "0")
|
|
285
|
+
gen_num=$(echo "$gen" | sed 's/gen0*//')
|
|
286
|
+
color=$(get_gen_color "$gen_num")
|
|
287
|
+
echo "$gen_index \"$gen\" $avg \"$color\"" >>"$gen_avg_file"
|
|
288
|
+
((gen_index++))
|
|
289
|
+
fi
|
|
290
|
+
fi
|
|
291
|
+
done
|
|
292
|
+
|
|
219
293
|
# Create winner data point
|
|
220
294
|
if [[ -n $max_id ]]; then
|
|
221
295
|
echo "$max_row \"$max_id\" $max_perf" >"$winner_file"
|
|
222
296
|
fi
|
|
223
297
|
|
|
224
|
-
# Generate plot
|
|
225
|
-
|
|
226
|
-
|
|
298
|
+
# Generate dual plot
|
|
299
|
+
if [[ -s "$data_file" ]]; then
|
|
300
|
+
gnuplot <<EOF
|
|
301
|
+
set terminal png size 1200,800
|
|
227
302
|
set output "$output_file"
|
|
228
|
-
|
|
303
|
+
|
|
304
|
+
# Set up multiplot with proper spacing
|
|
305
|
+
set multiplot layout 2,1 margins 0.08,0.82,0.15,0.95 spacing 0.1,0.15
|
|
306
|
+
|
|
307
|
+
#=================== TOP PLOT: Performance Over Time ===================
|
|
308
|
+
set title "Algorithm Evolution Performance Over Time" font ",14"
|
|
229
309
|
set xlabel "Evolution Run"
|
|
230
310
|
set ylabel "Performance Score"
|
|
231
311
|
set grid
|
|
232
|
-
set key
|
|
233
|
-
|
|
234
|
-
#
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
"$
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
set
|
|
312
|
+
set key outside right
|
|
313
|
+
|
|
314
|
+
# Define colors for generations
|
|
315
|
+
plot "$data_file" using (\$4==1?\$1:1/0):3 with linespoints linewidth 2 linecolor rgb "#1f77b4" pointsize 0.8 title "Gen 1", \\
|
|
316
|
+
"$data_file" using (\$4==2?\$1:1/0):3 with linespoints linewidth 2 linecolor rgb "#ff7f0e" pointsize 0.8 title "Gen 2", \\
|
|
317
|
+
"$data_file" using (\$4==3?\$1:1/0):3 with linespoints linewidth 2 linecolor rgb "#2ca02c" pointsize 0.8 title "Gen 3", \\
|
|
318
|
+
"$data_file" using (\$4==4?\$1:1/0):3 with linespoints linewidth 2 linecolor rgb "#d62728" pointsize 0.8 title "Gen 4", \\
|
|
319
|
+
"$data_file" using (\$4==5?\$1:1/0):3 with linespoints linewidth 2 linecolor rgb "#9467bd" pointsize 0.8 title "Gen 5", \\
|
|
320
|
+
"$winner_file" using 1:3 with points pointtype 7 pointsize 4 linecolor rgb "#000000" title "Winner"
|
|
321
|
+
|
|
322
|
+
#=================== BOTTOM PLOT: Generation Averages ===================
|
|
323
|
+
set title "Average Performance by Generation" font ",14"
|
|
324
|
+
set xlabel "Generation"
|
|
325
|
+
set ylabel "Avg Performance"
|
|
326
|
+
set style fill solid 0.8
|
|
327
|
+
set boxwidth 0.6
|
|
328
|
+
unset key
|
|
329
|
+
set grid y
|
|
330
|
+
|
|
331
|
+
# Set custom x-axis labels
|
|
332
|
+
set xtics ("Gen1" 1, "Gen2" 2, "Gen3" 3, "Gen4" 4, "Gen5" 5)
|
|
333
|
+
|
|
334
|
+
plot "$gen_avg_file" using 1:3 with boxes linecolor rgb "#4CAF50" notitle
|
|
335
|
+
|
|
336
|
+
unset multiplot
|
|
337
|
+
|
|
338
|
+
# Add winner label at bottom
|
|
339
|
+
set terminal png size 1200,830
|
|
340
|
+
set output "$output_file"
|
|
341
|
+
set label "Best Overall: $max_id (Score: $max_perf)" at screen 0.5, 0.05 center font ",12"
|
|
342
|
+
replot
|
|
245
343
|
EOF
|
|
344
|
+
else
|
|
345
|
+
echo "[WARN] No valid performance data to plot"
|
|
346
|
+
exit 0
|
|
347
|
+
fi
|
|
246
348
|
|
|
247
|
-
rm -f "$data_file" "$winner_file"
|
|
349
|
+
rm -f "$data_file" "$winner_file" "$gen_avg_file" "$gen_data_temp"
|
|
248
350
|
echo "Chart saved to: $output_file"
|
|
249
351
|
|
|
250
352
|
# Always try to open chart (not just when --open is used)
|
|
@@ -258,9 +360,9 @@ EOF
|
|
|
258
360
|
echo "[WARN] Cannot open chart automatically. View: $output_file"
|
|
259
361
|
fi
|
|
260
362
|
else
|
|
261
|
-
if [[ $
|
|
363
|
+
if [[ $valid_performance_count -eq 0 ]]; then
|
|
262
364
|
echo
|
|
263
|
-
echo "No performance data available for chart generation."
|
|
365
|
+
echo "No valid performance data available for chart generation."
|
|
264
366
|
echo "Run 'claude-evolve run' to execute candidates first."
|
|
265
367
|
else
|
|
266
368
|
echo
|