Download scripts/_tmp_maxvar.py from mattbitzesty/pino-source-code: direct link, hf CLI and curl.
- Browser
- Download file 776 Bytes
-
https://huggingface.co/mattbitzesty/pino-source-code/resolve/e12dde84fe90540d000add61648844fbfd8ebdc7/scripts/_tmp_maxvar.py
- Command line
-
hf download hf://mattbitzesty/pino-source-code@e12dde84fe90540d000add61648844fbfd8ebdc7/scripts/_tmp_maxvar.py
-
curl -L -o _tmp_maxvar.py https://huggingface.co/mattbitzesty/pino-source-code/resolve/e12dde84fe90540d000add61648844fbfd8ebdc7/scripts/_tmp_maxvar.py
776 Bytes
| import json | |
| import numpy as np | |
| from pathlib import Path | |
| lines = Path('data/empirical_dataset_v2.jsonl').read_text().splitlines() | |
| records = [json.loads(l) for l in lines] | |
| variances = [] | |
| for rec in records: | |
| obj = np.array(rec['objective_targets']) | |
| variances.append(float(obj.var(axis=0).mean())) | |
| variances = np.array(variances) | |
| idx = int(np.argmax(variances)) | |
| print('max variance record', idx, variances[idx]) | |
| print('genre', records[idx].get('genre')) | |
| print('metadata', records[idx].get('metadata')) | |
| print('formula', [(c.get('cas'), c.get('name'), c.get('weight_fraction')) for c in records[idx]['formula']]) | |
| print('objective_targets first 5 rows', records[idx]['objective_targets'][:5]) | |
| print('objective_targets last 5 rows', records[idx]['objective_targets'][-5:]) | |