Skip to content

Commit

Permalink
Merge branch 'fix_selftests' of github.com:GrainLearning/grainLearnin…
Browse files Browse the repository at this point in the history
…g into fix_selftests
  • Loading branch information
chyalexcheng committed Jan 16, 2024
2 parents 58fa78b + 9af1619 commit dd3820b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions grainlearning/dynamic_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(
#### Uncertainty ####

self.sigma_min = 1.0e-6

self.sigma_max = sigma_max

self.sigma_tol = sigma_tol
Expand Down Expand Up @@ -383,7 +383,7 @@ class IODynamicSystem(DynamicSystem):
:param inv_obs_weight: Inverse of the observation weight, defaults to None, optional
:param param_data: Parameter data, defaults to None, optional
:param sim_data: Simulation data, defaults to None, optional
:param sim_data_files: List pf simulation data files (num_samples), defaults to None, optional
:param sim_data_files: List of simulation data files (num_samples), defaults to None, optional
"""

def __init__(
Expand Down Expand Up @@ -428,7 +428,7 @@ def __init__(
param_names
)
# TODO: reuse initialization from base class

##### Parameters #####

self.num_params = len(param_names)
Expand Down
2 changes: 0 additions & 2 deletions grainlearning/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def __init__(

self.ess = None



@classmethod
def from_dict(cls: Type["SMC"], obj: dict):
"""Initialize the class using a dictionary style
Expand Down
6 changes: 3 additions & 3 deletions grainlearning/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ class GaussianMixtureModel:

def __init__(
self,
max_num_components=0,
weight_concentration_prior: float = 0.2,
max_num_components = 0,
weight_concentration_prior: float = 0.0,
covariance_type: str = "tied",
n_init: int = 1,
tol: float = 1.0e-5,
Expand All @@ -106,7 +106,7 @@ def __init__(
""" Initialize the Gaussian Mixture Model class"""
self.max_num_components = max_num_components

if weight_concentration_prior is None:
if not weight_concentration_prior:
self.weight_concentration_prior = 1.0 / max_num_components
else:
self.weight_concentration_prior = weight_concentration_prior
Expand Down
15 changes: 7 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ license = "GPLv2"
homepage = "https://grainlearning.readthedocs.io/"
repository = "https://github.com/GrainLearning/grainLearning"
keywords = ["Bayesian inference", "Uncertainty quantification", "Non-parametric Gaussian mixture", "DEM", "Constitutive modeling", "Granular materials"]
packages = [
{ include = "grainlearning"}
]

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
python = ">=3.8,<3.12"
numpy = "^1.23.2"
scipy = "^1.9.1"
scikit-learn = "^1.1.3"
matplotlib = "^3.6.0"
seaborn = '^0.12.2'

Sphinx = {version = "^5.1.1", optional = true}
sphinx-autodoc-typehints = {version = "^1.19.2", optional = true}
Expand All @@ -30,21 +34,16 @@ prospector = {version = "^1.7.6", optional = true, extras = ["with_pyroma"]}
pyroma = {version = "^4.0", optional = true}
h5py = {version ="^3.7.0", optional = true}
wandb = {version ="^0.13.4", optional = true}
tensorflow = {version ="2.10.0", optional = true}
tensorflow = {version ="^2.10.0", optional = true}
ipykernel = {version = "*", optional = true}
seaborn = {version = '^0.12.2', optional = true}

[tool.poetry.extras]
docs = ["Sphinx", "sphinx-autodoc-typehints", "sphinx-mdinclude", "sphinx-rtd-theme"]
dev = ["pytest", "pytest-cov", "prospector", "pyroma", "h5py"]
dev = ["pytest", "pytest-cov", "prospector", "pyroma", "h5py", "tensorflow", "wandb"]
rnn = ["wandb", "tensorflow"]
tutorials = ["ipykernel"]
visuals = ["seaborn"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

packages = [
{ include = "grainlearning"}
]

0 comments on commit dd3820b

Please sign in to comment.