Skip to main content

Evaluation metrics for The Closure Challenge RANS benchmark

Project description

Closure Challenge

PyPI version

A benchmark challenge for evaluating machine learning-augmented RANS closure models. The main challenge page is https://github.com/rmcconke/closure-challenge-benchmark. This repo is for the evaluation source code.

Installation

pip install closure-challenge

Quick Start

You need to interpolate your data onto the evaluation points:

from closure_challenge import evaluation_points
xyz_eval = evaluation_points(case) #(1000,3) numpy array for each case

Then, there are 2 ways to get your score from the package:

Method 1: Direct scoring, using python

from closure_challenge import score, evaluation_points, case_names
from scipy.interpolate import griddata # interpolation method/library is up to you

your_grid_points = {...}   # Dict[case_name -> (N, 3) array of xyz coordinates]
your_model_results = {...} # Dict[case_name -> (N, 3) array of velocity vectors]

predictions = {}
for case in case_names():
    # your model predictions on your grid
    xyz_your_points = your_grid_points[case]
    U_your_points = your_model_results[case]  

    # evaluation_points returns shape (1000, 3) where columns are [x, y, z]
    xyz_eval = evaluation_points(case)       

    # again, interpolation method/library is up to you
    U_pred = griddata(xyz_your_points, U_your_points, xyz_eval, method='nearest') 
    
    predictions[case] = U_pred


final_score = score(predictions)

Method 2: Loading from CSV files

This is what will be used when updating the main challenge github with your submitted files.

You can pass in either:

  1. The path to a folder containing your interpolated predictions on the test cases, which should be stored in the files:
  • alpha_15_13929_4048.csv
  • alpha_15_13929_2024.csv
  • alpha_05_4071_4048.csv
  • alpha_05_4071_2024.csv
  • AR_1_Ret_360.csv
  • AR_3_Ret_360.csv
  • AR_14_Ret_180.csv
  • PHLL10595.csv
  • CBFS13700.csv
from closure_challenge import score_from_csv
final_score = score_from_csv("path/to/predictions/")
  1. A dictionary containing paths to your interpolated predictions for each of the test cases.
from closure_challenge import score_from_csv
final_score = score_from_csv({
    "alpha_15_13929_4048": "path/to/your/alpha_15_13929_4048/predictions.csv",
    "alpha_15_13929_2024": "path/to/your/alpha_15_13929_2024/predictions.csv",
    "alpha_05_4071_4048": "path/to/your/alpha_05_4071_4048/predictions.csv",
    "alpha_05_4071_2024": "path/to/your/alpha_05_4071_2024/predictions.csv",
    "AR_1_Ret_360": "path/to/your/AR_1_Ret_360/predictions.csv",
    "AR_3_Ret_360": "path/to/your/AR_3_Ret_360/predictions.csv",
    "AR_14_Ret_180": "path/to/your/AR_14_Ret_180/predictions.csv",
    "PHLL10595": "path/to/your/PHLL10595/predictions.csv",
    "CBFS13700": "path/to/your/CBFS13700/predictions.csv",
})

Scoring

The benchmark uses scaled Mean Absolute Error (MAE). Each case's error is normalized by the mean magnitude of the true velocity field, then summed across all cases.

Available functions

i.e., you can do from closure_challenge import:

  • case_names() - List of test cases
  • evaluation_points(case) - Get evaluation (x, y, z) coordinates for a case
  • score(predictions) - Calculate final benchmark score (see Method 1 above)
  • evaluate_by_case(predictions) - Get individual case scores returned (Method 1)
  • score_from_csv(path) - Calculate final benchmark score from CSV files (see Method 2 above)
  • evaluate_from_csv_by_case(path) - Get individual case scores returned (Method 2)

Test Cases

The current scoring set includes these cases, which you can get by

  • alpha_15_13929_4048
  • alpha_15_13929_2024
  • alpha_05_4071_4048
  • alpha_05_4071_2024
  • AR_1_Ret_360
  • AR_3_Ret_360
  • AR_14_Ret_180
  • PHLL10595
  • CBFS13700

You can get these names using

from closure_challenge import case_names
print(case_names())

Reminder: DO NOT train or validate on any of these cases. In other words, you cannot use them during training in any way. This violates the challenge rules.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

closure_challenge-0.2.0.tar.gz (919.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

closure_challenge-0.2.0-py3-none-any.whl (241.3 kB view details)

Uploaded Python 3

File details

Details for the file closure_challenge-0.2.0.tar.gz.

File metadata

  • Download URL: closure_challenge-0.2.0.tar.gz
  • Upload date:
  • Size: 919.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22","id":"wilma","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for closure_challenge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 488b47dd6dc03cbdbac1300e9363852ac5f7702cbab92713bf0ae6a4a8cf2b79
MD5 8cee6914b261fc3c3e27b541f3141206
BLAKE2b-256 6ef1c495405833829261efaa3aefde285ce4e0223c0766eba8459cca375b7ab8

See more details on using hashes here.

File details

Details for the file closure_challenge-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: closure_challenge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 241.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22","id":"wilma","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for closure_challenge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0616d83e810d9ab14913ccb5fe132ef899adb5cbd424f7d1e974c3d97695b872
MD5 30d3a15c5782994d25bd9f0d00dd3bc8
BLAKE2b-256 225b133e232d3c2cddca705cec6b6eb6e340e305f0fb6ca625e109ab6b0d7d21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page