@@ -2341,8 +2341,7 @@ def classifier_test_cli(
2341
2341
predictions , reference_profile ["height" ], reference_profile ["width" ], nodata_mask
2342
2342
)
2343
2343
2344
- metrics_dict = score_predictions (y , predictions , test_metrics )
2345
- # json_str = json.dumps(metrics_dict)
2344
+ metrics_dict = score_predictions (y , predictions , get_enum_values (test_metrics ))
2346
2345
typer .echo ("Progress: 80%" )
2347
2346
2348
2347
out_profile = reference_profile .copy ()
@@ -2353,14 +2352,12 @@ def classifier_test_cli(
2353
2352
with rasterio .open (output_raster_classified , "w" , ** out_profile ) as dst :
2354
2353
dst .write (predictions_reshaped , 1 )
2355
2354
2356
- typer .echo ("Progress: 100%\n " )
2357
- # typer.echo(f"Results:")
2358
-
2355
+ typer .echo ("\n " )
2359
2356
for key , value in metrics_dict .items ():
2360
2357
typer .echo (f"{ key } : { value } " )
2361
-
2362
2358
typer .echo ("\n " )
2363
2359
2360
+ typer .echo ("Progress: 100%" )
2364
2361
typer .echo (
2365
2362
(
2366
2363
"Testing classifier model completed, writing rasters to "
@@ -2388,28 +2385,26 @@ def regressor_test_cli(
2388
2385
2389
2386
model = load_model (model_file )
2390
2387
predictions = predict_regressor (X , model )
2391
- metrics_dict = score_predictions (y , predictions , test_metrics )
2392
2388
predictions_reshaped = reshape_predictions (
2393
2389
predictions , reference_profile ["height" ], reference_profile ["width" ], nodata_mask
2394
2390
)
2395
- typer .echo ("Progress: 80%" )
2396
2391
2397
- # json_str = json.dumps(metrics_dict)
2392
+ metrics_dict = score_predictions (y , predictions , get_enum_values (test_metrics ))
2393
+ typer .echo ("Progress: 80%" )
2398
2394
2399
2395
out_profile = reference_profile .copy ()
2400
2396
out_profile .update ({"count" : 1 , "dtype" : np .float32 })
2401
2397
2402
2398
with rasterio .open (output_raster , "w" , ** out_profile ) as dst :
2403
2399
dst .write (predictions_reshaped , 1 )
2404
2400
2405
- typer .echo ("Progress: 100%\n " )
2406
- # typer.echo("Results: ")
2407
-
2401
+ typer .echo ("\n " )
2408
2402
for key , value in metrics_dict .items ():
2409
2403
typer .echo (f"{ key } : { value } " )
2410
-
2411
2404
typer .echo ("\n " )
2412
2405
2406
+ typer .echo ("Progress: 100%\n " )
2407
+
2413
2408
typer .echo (f"Testing regressor model completed, writing raster to { output_raster } ." )
2414
2409
2415
2410
0 commit comments