Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
f81904a898
|
|||
88d961313c
|
|||
fa82caa752
|
|||
0784cd53d7
|
|||
fb4b012491
|
|||
8617e4d274
|
21
CHANGELOG.md
21
CHANGELOG.md
@@ -2,6 +2,27 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.3.5](https://gitea.deepak.science:2222/physics/deepdog/compare/0.3.4...0.3.5) (2022-03-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* makes chunksize configurable ([88d9613](https://gitea.deepak.science:2222/physics/deepdog/commit/88d961313c1db0d49fd96939aa725a8706fa0412))
|
||||
|
||||
### [0.3.4](https://gitea.deepak.science:2222/physics/deepdog/compare/0.3.3...0.3.4) (2022-03-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Changes chunksize for multiprocessing ([0784cd5](https://gitea.deepak.science:2222/physics/deepdog/commit/0784cd53d79e00684506604f094b5d820b3994d4))
|
||||
|
||||
### [0.3.3](https://gitea.deepak.science:2222/physics/deepdog/compare/0.3.2...0.3.3) (2022-03-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fixes count to use cycles as well ([8617e4d](https://gitea.deepak.science:2222/physics/deepdog/commit/8617e4d2742b112cc824068150682ce3b2cdd879))
|
||||
|
||||
### [0.3.2](https://gitea.deepak.science:2222/physics/deepdog/compare/0.3.1...0.3.2) (2022-03-06)
|
||||
|
||||
|
||||
|
@@ -10,8 +10,7 @@ import numpy
|
||||
|
||||
|
||||
# TODO: remove hardcode
|
||||
COST_THRESHOLD = 1e-10
|
||||
|
||||
CHUNKSIZE = 50
|
||||
|
||||
# TODO: It's garbage to have this here duplicated from pdme.
|
||||
DotInput = Tuple[numpy.typing.ArrayLike, float]
|
||||
@@ -44,7 +43,7 @@ class AltBayesRun():
|
||||
run_count: int
|
||||
The number of runs to do.
|
||||
'''
|
||||
def __init__(self, dot_inputs: Sequence[DotInput], discretisations_with_names: Sequence[Tuple[str, pdme.model.Discretisation]], actual_model: pdme.model.Model, filename_slug: str, run_count: int, low_error: float = 0.9, high_error: float = 1.1, monte_carlo_count: int = 10000, monte_carlo_cycles: int = 10, max_frequency: float = 20, end_threshold: float = None) -> None:
|
||||
def __init__(self, dot_inputs: Sequence[DotInput], discretisations_with_names: Sequence[Tuple[str, pdme.model.Discretisation]], actual_model: pdme.model.Model, filename_slug: str, run_count: int, low_error: float = 0.9, high_error: float = 1.1, monte_carlo_count: int = 10000, monte_carlo_cycles: int = 10, max_frequency: float = 20, end_threshold: float = None, chunksize: int = CHUNKSIZE) -> None:
|
||||
self.dot_inputs = dot_inputs
|
||||
self.dot_inputs_array = pdme.measurement.oscillating_dipole.dot_inputs_to_array(dot_inputs)
|
||||
self.discretisations = [disc for (_, disc) in discretisations_with_names]
|
||||
@@ -58,6 +57,7 @@ class AltBayesRun():
|
||||
self.high_error = high_error
|
||||
self.csv_fields = ["dipole_moment", "dipole_location", "dipole_frequency"]
|
||||
self.compensate_zeros = True
|
||||
self.chunksize = chunksize
|
||||
for name in self.model_names:
|
||||
self.csv_fields.extend([f"{name}_success", f"{name}_count", f"{name}_prob"])
|
||||
|
||||
@@ -98,7 +98,7 @@ class AltBayesRun():
|
||||
_logger.debug(f"Doing discretisation #{disc_count}")
|
||||
with multiprocessing.Pool(multiprocessing.cpu_count() - 1 or 1) as pool:
|
||||
results.append(sum(
|
||||
pool.imap_unordered(get_a_result, [(discretisation, self.dot_inputs_array, lows, highs, self.monte_carlo_count, self.max_frequency)] * self.monte_carlo_cycles)
|
||||
pool.imap_unordered(get_a_result, [(discretisation, self.dot_inputs_array, lows, highs, self.monte_carlo_count, self.max_frequency)] * self.monte_carlo_cycles, self.chunksize)
|
||||
))
|
||||
|
||||
_logger.debug("Done, constructing output now")
|
||||
@@ -112,9 +112,9 @@ class AltBayesRun():
|
||||
for model_index, (name, result) in enumerate(zip(self.model_names, results)):
|
||||
|
||||
row[f"{name}_success"] = result
|
||||
row[f"{name}_count"] = self.monte_carlo_count
|
||||
row[f"{name}_count"] = self.monte_carlo_count * self.monte_carlo_cycles
|
||||
successes.append(max(result, 0.5))
|
||||
counts.append(self.monte_carlo_count)
|
||||
counts.append(self.monte_carlo_count * self.monte_carlo_cycles)
|
||||
|
||||
success_weight = sum([(succ / count) * prob for succ, count, prob in zip(successes, counts, self.probabilities)])
|
||||
new_probabilities = [(succ / count) * old_prob / success_weight for succ, count, old_prob in zip(successes, counts, self.probabilities)]
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "deepdog"
|
||||
version = "0.3.2"
|
||||
version = "0.3.5"
|
||||
description = ""
|
||||
authors = ["Deepak Mallubhotla <dmallubhotla+github@gmail.com>"]
|
||||
|
||||
|
Reference in New Issue
Block a user