Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
37d5ccf
Adds demo notebook
May 8, 2020
941f592
Changes the baseline to linear power alone
May 8, 2020
d0f8c6c
Adding code for 5 bins classif
EiffL May 8, 2020
000b87d
Adds new script for tomo challenge
EiffL May 10, 2020
19c4acf
Fixes problem
May 10, 2020
e611c06
Adds script that trains neural network
EiffL May 10, 2020
8816bdb
changes output name for NN
EiffL May 10, 2020
94e9853
Adds example notebook
EiffL May 10, 2020
f40a73c
Adds some trained models
EiffL May 10, 2020
76e5957
Delete BinningNN5.pckl
EiffL May 10, 2020
b91da4d
Delete BinningNN5b.pckl
EiffL May 10, 2020
9745b73
Delete LearningToBin-2bins-new.ipynb
EiffL May 10, 2020
39b9fae
Delete LearningToBin-5bins.ipynb
EiffL May 10, 2020
dea8380
Delete LearningToBin-5binsb.ipynb
EiffL May 10, 2020
fe7218a
Delete LearningToBin.ipynb
EiffL May 10, 2020
1f0a89c
adds modifs
May 10, 2020
0024148
Merge branch 'master' of github.com:EiffL/tomo_challenge
May 10, 2020
ab8b797
Merge remote-tracking branch 'upstream/master'
EiffL May 11, 2020
75757e3
Adapting code to new metrics
EiffL May 11, 2020
9b029e3
Merge branch 'master' of github.com:EiffL/tomo_challenge
May 11, 2020
e1abd14
Merge remote-tracking branch 'upstream/master'
May 12, 2020
e2b6c20
Changes config to be compatible with cosmo jax
May 12, 2020
61c0d96
updates jax metrics
EiffL May 13, 2020
f942ea0
Adds first draft of neural network classifier
May 13, 2020
8882e1a
Merge branch 'master' of github.com:EiffL/tomo_challenge
May 13, 2020
b42e831
Adds better NN class
May 13, 2020
6509842
Automatic neural network classif working
EiffL May 13, 2020
083867c
Updates all code
EiffL May 13, 2020
a52f4b6
Adds notebook demo-ing the training by FoM
EiffL May 13, 2020
e40e094
Adds plots and stuff
EiffL May 13, 2020
dbfe3f4
udpate of the notebook
EiffL May 13, 2020
b6e4f37
Fixes the requirement file
May 14, 2020
ccf86fc
Merge remote-tracking branch 'upstream/master'
EiffL Jul 4, 2020
ec06c7f
Adds new metrics
EiffL Jul 21, 2020
491375f
Minor modifs
EiffL Jul 21, 2020
b348e0b
Merge remote-tracking branch 'upstream/jax_cosmo'
EiffL Jul 21, 2020
f45ab8c
updates nn code
EiffL Jul 21, 2020
232b796
Update challenge to latest version
EiffL Jul 21, 2020
fe88870
removed outdated stuff
EiffL Jul 21, 2020
99a774c
Merge remote-tracking branch 'upstream/master'
EiffL Sep 15, 2020
f71d0a6
clean up
EiffL Sep 15, 2020
2cd790f
Undo modifs to data.py
EiffL Sep 15, 2020
6c17333
undo modifs to config.yml
EiffL Sep 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

*.hdf5
notebooks/dev/
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ You will get two datasets, based on two different simulations, which will allow
The first dataset, which can be found under `data` after download is based on the CosmoDC2 simulation. The second dataset, found under
`data_buzzard` is based on the Buzzard simulations.

## Installing dependencies

From the root folder:
```
$ pip install -r requirements.txt
```


## Metric

Expand Down
2 changes: 0 additions & 2 deletions bin/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ def run_one(classifier_name, bands, settings, train_data, train_z, valid_data,
name = str(classifier.__name__)
code = abs(hash(str(settings)))
tc.metrics.plot_distributions(valid_z, results, f"plots/{name}_{code}_{bands}.png", metadata=settings)

return scores


if __name__=="__main__":
main()
5 changes: 5 additions & 0 deletions example/example_output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RandomForest run_1 {'bins': 1} {'SNR_ww': 134.80948870306673, 'SNR_gg': 555.4535070472674, 'SNR_3x2': 562.3045275125236, 'FOM_3x2': 11406.381379130828}
RandomForest run_2 {'bins': 2} {'SNR_ww': 153.37996427859213, 'SNR_gg': 749.4259413373646, 'SNR_3x2': 752.8800006487635, 'FOM_3x2': 11420.79691061082}
RandomForest run_3 {'bins': 3} {'SNR_ww': 159.18538698343457, 'SNR_gg': 922.7346985760454, 'SNR_3x2': 925.4853956272517, 'FOM_3x2': 43768.68018337518}
RandomForest run_4 {'bins': 4} {'SNR_ww': 160.84108815042694, 'SNR_gg': 1037.3860103346599, 'SNR_3x2': 1039.8374894959643, 'FOM_3x2': 13800.43390167526}
IBandOnly run_3 {'bins': 3} {'SNR_ww': 135.13888426367922, 'SNR_gg': 565.866023397332, 'SNR_3x2': 572.2806557629426, 'FOM_3x2': 25548.34390335924}
34 changes: 34 additions & 0 deletions example/neural_network_buzzard_griz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
metrics: [SNR_ww, SNR_gg, SNR_3x2, FOM_3x2, FOM_DETF_3x2]
bands: griz
training_file: data_buzzard/training.hdf5
validation_file: data_buzzard/validation.hdf5
output_file: example/neural_output_buzzard_griz.txt
# Backend implementing the metrics, either: "firecrown" (default), "jax-cosmo"
metrics_impl: jax-cosmo

run:
# hello
NeuralNetwork:
{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: FOM_DETF
output_dir: models_buzzard
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}

{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: SNR
output_dir: models_buzzard
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}
34 changes: 34 additions & 0 deletions example/neural_network_buzzard_riz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
metrics: [SNR_ww, SNR_gg, SNR_3x2, FOM_3x2, FOM_DETF_3x2]
bands: riz
training_file: data_buzzard/training.hdf5
validation_file: data_buzzard/validation.hdf5
output_file: example/neural_output_buzzard_riz.txt
# Backend implementing the metrics, either: "firecrown" (default), "jax-cosmo"
metrics_impl: jax-cosmo

run:
# hello
NeuralNetwork:
{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: FOM_DETF
output_dir: models_buzzard
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}

{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: SNR
output_dir: models_buzzard
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}
34 changes: 34 additions & 0 deletions example/neural_network_dc2_griz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
metrics: [SNR_ww, SNR_gg, SNR_3x2, FOM_3x2, FOM_DETF_3x2]
bands: griz
training_file: data/training.hdf5
validation_file: data/validation.hdf5
output_file: example/neural_output_griz.txt
# Backend implementing the metrics, either: "firecrown" (default), "jax-cosmo"
metrics_impl: jax-cosmo

run:
# hello
NeuralNetwork:
{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: FOM_DETF
output_dir: models
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}

{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: SNR
output_dir: models
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}
34 changes: 34 additions & 0 deletions example/neural_network_dc2_riz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
metrics: [SNR_ww, SNR_gg, SNR_3x2, FOM_3x2, FOM_DETF_3x2]
bands: riz
training_file: data/training.hdf5
validation_file: data/validation.hdf5
output_file: example/neural_output_riz.txt
# Backend implementing the metrics, either: "firecrown" (default), "jax-cosmo"
metrics_impl: jax-cosmo

run:
# hello
NeuralNetwork:
{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: FOM_DETF
output_dir: models
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}

{% for nbins in [5, 10] %}
run_{{ nbins}}:
bins: {{ nbins }}
metric: SNR
output_dir: models
# These special settings decide whether the
# color and error colums are passed to the classifier
# as well as the magnitudes
colors: True
errors: True
{% endfor %}
3 changes: 3 additions & 0 deletions example/neural_output_fom.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NeuralNetwork run_2 {'bins': 2, 'metric': 'FOM'} {'SNR_ww': 135.7762701025696, 'SNR_gg': 747.3564650562411, 'SNR_3x2': 752.2536087103781, 'FOM_3x2': 9051.18761144165}
NeuralNetwork run_3 {'bins': 3, 'metric': 'FOM'} {'SNR_ww': 138.1739975730084, 'SNR_gg': 843.9211384344102, 'SNR_3x2': 847.0072653794633, 'FOM_3x2': 84547.97008004926}
NeuralNetwork run_4 {'bins': 4, 'metric': 'FOM'} {'SNR_ww': 143.93512392186238, 'SNR_gg': 937.789093247378, 'SNR_3x2': 940.4664612599967, 'FOM_3x2': 14978.628112642044}
3 changes: 3 additions & 0 deletions example/neural_output_snr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NeuralNetwork run_2 {'bins': 2, 'metric': 'SNR'} {'SNR_ww': 135.8368248575087, 'SNR_gg': 770.3102116003334, 'SNR_3x2': 775.1787513453132, 'FOM_3x2': 19945.877149713706}
NeuralNetwork run_3 {'bins': 3, 'metric': 'SNR'} {'SNR_ww': 145.57034579817267, 'SNR_gg': 919.1359275700552, 'SNR_3x2': 921.8455311553354, 'FOM_3x2': 19930.736921522202}
NeuralNetwork run_4 {'bins': 4, 'metric': 'SNR'} {'SNR_ww': 159.623483697185, 'SNR_gg': 987.2312600491794, 'SNR_3x2': 989.8354725475687, 'FOM_3x2': 45587.37245610679}
1 change: 1 addition & 0 deletions models/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Folder for storing trained models
Loading