-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bones #43
Merged
Merged
Bones #43
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
114b4d9
Removing showyourwork leftovers
voetberg 89950f4
2.0
voetberg 57fc3c7
Bones
voetberg 1e3c706
replace img dir
voetberg cfc81ef
Bones update with forced subclass typing and list of modules in inits
voetberg 2195c76
Move dev packages, remove jupyter
voetberg 6c72253
outline of client's operation
voetberg 5f427f1
Simulator and register method
voetberg 25fc729
Tests for the cli client
voetberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import yaml | ||
from argparse import ArgumentParser | ||
|
||
from src.utils.config import Config | ||
from src.utils.defaults import Defaults | ||
from src.data import DataModules | ||
from src.models import ModelModules | ||
from src.metrics import Metrics | ||
from src.plots import Plots | ||
|
||
def parser(): | ||
parser = ArgumentParser() | ||
parser.add_argument("--config", '-c', default=None) | ||
|
||
# Model | ||
parser.add_argument("--model_path", '-m', default=None) | ||
parser.add_argument("--model_engine", '-e', default=Defaults['model']['model_engine'], choices=ModelModules.keys()) | ||
|
||
# Data | ||
parser.add_argument("--data_path", '-d', default=None) | ||
parser.add_argument("--data_engine", '-g', default=Defaults['data']['data_engine'], choices=DataModules.keys()) | ||
|
||
# Common | ||
parser.add_argument("--out_dir", default=Defaults['common']['out_dir']) | ||
|
||
# List of metrics (cannot supply specific kwargs) | ||
parser.add_argument("--metrics", nargs='+', default=Defaults['metrics'].keys(), choices=Metrics.keys()) | ||
|
||
# List of plots | ||
parser.add_argument("--plots", nargs='+', default=Defaults['plots'].keys(), choices=Plots.keys()) | ||
|
||
|
||
args = parser.parse_args() | ||
if args.config is not None: | ||
config = Config(args.config) | ||
|
||
else: | ||
tmp_config = './DeepDiagonistics/temp/temp_config.yml' # TODO Un-hardcode | ||
input_yaml = vars(args) # TODO Sections | ||
yaml.dump(input_yaml, open(tmp_config, "w")) | ||
config = Config(tmp_config) | ||
|
||
return config | ||
|
||
|
||
if __name__ == "__main__": | ||
config = parser() | ||
|
||
model_path = config.get_item("model", "model_path") | ||
model_engine = config.get_item("model", "model_engine") | ||
model = ModelModules[model_engine](model_path) | ||
|
||
data_path = config.get_item("data", "data_path") | ||
data_engine = config.get_item("data", "data_engine") | ||
data = DataModules[data_engine](data_path) | ||
|
||
out_dir = config.get_item("common", "out_dir") | ||
|
||
metrics = config.get_section("metrics") | ||
plots = config.get_section("plots") | ||
|
||
for metrics_name, metrics_args in metrics.items(): | ||
Metrics[metrics_name](model, data, **metrics_args)() | ||
|
||
for plot_name, plot_args in plots.items(): | ||
Plots[plot_name](model, data, save=True, show=False, out_dir=out_dir)(**plot_args) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
from typing import TypeVar | ||
|
||
from src.data.data import Data | ||
from src.data.h5_data import H5Data | ||
from src.data.pickle_data import PickleData | ||
|
||
data = TypeVar("data", Data) | ||
|
||
DataModules = { | ||
"H5Data": H5Data, | ||
"PickleData": PickleData | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from typing import TypeVar | ||
|
||
from src.metrics.metric import Metric | ||
|
||
metric = TypeVar("metric", Metric) | ||
Metrics = { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from typing import TypeVar | ||
|
||
from src.models.sbi_model import SBIModel | ||
from src.models.model import Model | ||
|
||
model = TypeVar("model", Model) | ||
ModelModules = { | ||
"SBIModel": SBIModel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from typing import TypeVar | ||
from src.plots.plot import Display | ||
|
||
display = TypeVar("display", Display) | ||
Plots = { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Defaults = { | ||
"common":{ | ||
"out_dir":"./DeepDiagonistics/results/", | ||
}, | ||
"model": { | ||
"model_engine": "SBIModel" | ||
}, | ||
"data":{ | ||
"data_engine": "H5Data" | ||
}, | ||
"plot_common": { | ||
"axis_spines": False, | ||
"tight_layout": True, | ||
"colorway": "virdids", | ||
"plot_style": "fast" | ||
}, | ||
"plots":{ | ||
"type_of_plot":{"specific_kwargs"} | ||
}, | ||
"metric_common": { | ||
|
||
}, | ||
"metrics":{ | ||
"type_of_metrics":{"specific_kwargs"} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Varaibles: | ||
def __init__(self, session="") -> None: | ||
self.session = {} | ||
|
||
def add_variable(): | ||
pass | ||
|
||
def read_variable(): | ||
pass | ||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beckynevin is the posterior the only object we'll do any diagnostics on? If we wanted to expand to include the likelihood (e.g., SNLE) in a beta version, do you know if that would require significant structural changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would using the likelihood require? Would it require running the MCMC chain to get to the posterior? Or are you talking about evaluating the likelihood itself? Both would require significant structural changes; the former would require the package to handle MCMCing while the later I think would require redesigning the metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking if people wanted to stop at the Likelihood and not go to the Posterior.
I don't think we've talked about metrics/diagnostics for that, but I wasn't sure if you had any schemes going in that direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not advocating for adding more tools to get a posterior from the likelihood.