python_code stringlengths 0 4.04M | repo_name stringlengths 7 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import warnings
import beanmachine.ppl as bm
import numpy as np
import pytest
import torch
import torch.distributions as dist
from beanmach... | beanmachine-main | tests/ppl/inference/proposer/hmc_utils_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
import torch.distributions as dist
from beanmachine import ppl as bm
from beanmachine.ppl.inference.proposer.n... | beanmachine-main | tests/ppl/inference/proposer/nmc/single_site_simplex_newtonian_monte_carlo_proposer_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
import torch.distributions as dist
from beanmachine.ppl.inference.proposer.nmc im... | beanmachine-main | tests/ppl/inference/proposer/nmc/single_site_half_space_newtonian_monte_carlo_proposer_test.py |
beanmachine-main | tests/ppl/inference/proposer/nmc/__init__.py | |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
import torch.autograd
import torch.distributions as dist
from beanmachine.ppl.inf... | beanmachine-main | tests/ppl/inference/proposer/nmc/single_site_real_space_newtonian_monte_carlo_proposer_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for fix_problems.py"""
import unittest
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.c... | beanmachine-main | tests/ppl/compiler/fix_problems_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# BM -> BMG compiler index tests
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_in... | beanmachine-main | tests/ppl/compiler/index_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for tutorial on GMM with Poisson number of components"""
# This file is a manual replica of the Bento tutorial with the s... | beanmachine-main | tests/ppl/compiler/tutorial_GMM_with_2_dimensions_and_4_components_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compare original and conjugate prior transformed
Beta-Bernoulli model"""
import unittest
import beanmachine.ppl as bm
from beanmachi... | beanmachine-main | tests/ppl/compiler/fix_beta_bernoulli_basic_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import platform
import re
import unittest
import beanmachine.graph as graph
import beanmachine.ppl as bm
import beanmachine.ppl.compiler.pe... | beanmachine-main | tests/ppl/compiler/perf_report_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test of realistic coin flip model"""
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_inferenc... | beanmachine-main | tests/ppl/compiler/coin_flip_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_inference import BMGInference
from torch.distributions impo... | beanmachine-main | tests/ppl/compiler/log_prob_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for poisson distribution"""
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from... | beanmachine-main | tests/ppl/compiler/distribution_poisson_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""A basic unit test for the Python interface of the BMG C++ Graph.infer method"""
import unittest
import beanmachine.ppl as bm
from beanma... | beanmachine-main | tests/ppl/compiler/bmg_infer_interface_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for an example use of the normal distribution"""
import logging
import unittest
import beanmachine.ppl as bm
import tor... | beanmachine-main | tests/ppl/compiler/distribution_half_normal_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for an example use of the normal distribution"""
import logging
import unittest
import beanmachine.ppl as bm
import tor... | beanmachine-main | tests/ppl/compiler/distribution_normal_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for ast_tools.py"""
import ast
import unittest
import beanmachine.ppl.compiler.ast_tools as ast_tools
class ASTToolsTest(unittes... | beanmachine-main | tests/ppl/compiler/ast_tools_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for 1D GMM with K > 2 number of components"""
import logging
import unittest
# Comments after imports suggest alternati... | beanmachine-main | tests/ppl/compiler/tutorial_GMM_with_1_dimensions_and_4_components_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.compiler.gen_bmg_cpp import to_bm... | beanmachine-main | tests/ppl/compiler/column_index_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl.compiler.bmg_types as bt
import torch
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphB... | beanmachine-main | tests/ppl/compiler/lattice_typer_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Suppose we have a mixture of k normal distributions each with standard
# deviation equal to 1, but different means... | beanmachine-main | tests/ppl/compiler/gaussian_mixture_model_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_inference import BMGInference
from torch.distributions impo... | beanmachine-main | tests/ppl/compiler/to_probability_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.copy_and_replace import copy_and_replace
from beanmachine.ppl.c... | beanmachine-main | tests/ppl/compiler/devectorizer_transformer_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference.bmg_inference import BMGInference
from torch impor... | beanmachine-main | tests/ppl/compiler/bmg_bad_models_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.compiler.error_repor... | beanmachine-main | tests/ppl/compiler/size_assessment_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.gen_dot import to_dot
from beanmachine.ppl.compiler.runtime impo... | beanmachine-main | tests/ppl/compiler/sizer_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
import torch.distributions as dist
from beanmachine.ppl.inference import BMGInfer... | beanmachine-main | tests/ppl/compiler/gep_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Test performance of multiary multiplication optimization """
import platform
import unittest
import beanmachine.ppl as bm
from beanmachi... | beanmachine-main | tests/ppl/compiler/binary_vs_multiary_multiplication_perf_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for bmg_types.py"""
import unittest
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.comp... | beanmachine-main | tests/ppl/compiler/bmg_types_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for rules.py"""
import ast
import re
import unittest
from typing import Any
import astor
from beanmachine.ppl.compiler.ast_pattern... | beanmachine-main | tests/ppl/compiler/rules_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference import BMGInference
from to... | beanmachine-main | tests/ppl/compiler/transpose_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Test performance of multiary addition optimization """
import platform
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl... | beanmachine-main | tests/ppl/compiler/binary_vs_multiary_addition_perf_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl.compiler.bmg_nodes as bn
from beanmachine.ppl.compiler.bm_graph_builder impor... | beanmachine-main | tests/ppl/compiler/typer_base_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import operator
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference import BMGInference
from torch imp... | beanmachine-main | tests/ppl/compiler/matrix_multiplication_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compare original and conjugate prior transformed
Beta-Bernoulli model with operations on Bernoulli samples"""
import unittest
from b... | beanmachine-main | tests/ppl/compiler/fix_beta_bernoulli_ops_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for gen_builder.py"""
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.gen_builder import generate_build... | beanmachine-main | tests/ppl/compiler/gen_builder_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compare original and conjugate prior transformed
Beta-Binomial model"""
import unittest
import beanmachine.ppl as bm
from beanmachin... | beanmachine-main | tests/ppl/compiler/fix_binomial_logit_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_inference import BMGInference
from torch import tensor
from... | beanmachine-main | tests/ppl/compiler/gen_bm_python_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compare original and conjugate prior transformed
Beta-Bernoulli model with a hyperparameter given
by calling a non-random_variable ... | beanmachine-main | tests/ppl/compiler/fix_beta_bernoulli_const_added_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from torch.distributions import Normal
@b... | beanmachine-main | tests/ppl/compiler/query_type_zero_bug_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.compiler.gen_bmg_cpp import to_bm... | beanmachine-main | tests/ppl/compiler/bmg_factor_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from torch import tensor
from torch.distrib... | beanmachine-main | tests/ppl/compiler/bmg_query_test.py |
beanmachine-main | tests/ppl/compiler/__init__.py | |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for bmg_nodes.py"""
import unittest
import torch
from beanmachine.ppl.compiler.bmg_nodes import (
ConstantRealMatrixNode,
... | beanmachine-main | tests/ppl/compiler/bmg_nodes_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.comp... | beanmachine-main | tests/ppl/compiler/to_matrix_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for tutorial on GMM with Poisson number of components"""
# This file is a manual replica of the Bento tutorial with the s... | beanmachine-main | tests/ppl/compiler/gmm_1d_2comp_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import graphviz
from beanmachine.ppl.inference.bmg_inference import BMG... | beanmachine-main | tests/ppl/compiler/neals_funnel_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Comparison operators are not supported in BMG yet but we need to be able to detect
use of them and give an error. Here we verify that we ... | beanmachine-main | tests/ppl/compiler/comparison_rewriting_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
# The item() member function should be treated as an identity by the compiler
# for the purposes of graph generation.
impo... | beanmachine-main | tests/ppl/compiler/item_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from beanmachine.ppl.compiler.profiler import ProfilerData
class ProfilerTest(unittest.TestCase):
def test_profiler(s... | beanmachine-main | tests/ppl/compiler/profiler_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_inference import BMGInference
from torch.distributions impo... | beanmachine-main | tests/ppl/compiler/cycle_detector_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
import torch.distributions as dist
from beanmachine.ppl.in... | beanmachine-main | tests/ppl/compiler/bug_regression_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# """End-to-end test for n-schools model based on the one in PPL Bench"""
# See for example https://github.com/facebookresearch/pplbench/blo... | beanmachine-main | tests/ppl/compiler/n-schools_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for single_assignment.py"""
import ast
import unittest
import astor
from beanmachine.ppl.compiler.ast_patterns import ast_domain
f... | beanmachine-main | tests/ppl/compiler/single_assignment_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for bm_to_bmg.py"""
import unittest
import astor
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.bm_to_bmg import _bm_f... | beanmachine-main | tests/ppl/compiler/bm_to_bmg_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test of realistic logistic regression model"""
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bm... | beanmachine-main | tests/ppl/compiler/logistic_regression_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for error_report.py"""
import unittest
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.c... | beanmachine-main | tests/ppl/compiler/error_report_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from torch import tensor
from torch.distrib... | beanmachine-main | tests/ppl/compiler/fix_vectorized_models_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for bm_graph_builder.py"""
import unittest
from typing import Any
import torch
from beanmachine.ppl.compiler.bm_graph_builder impo... | beanmachine-main | tests/ppl/compiler/bm_graph_builder_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# LKJ Cholesky compiler tests
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BM... | beanmachine-main | tests/ppl/compiler/lkj_cholesky_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for bm_to_bmg.py"""
import math
import unittest
import astor
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.bm_to_bmg ... | beanmachine-main | tests/ppl/compiler/jit_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compilation test of Todd's Bayesian Multiple Testing model"""
import unittest
import beanmachine.ppl as bm
import torch.distributions as... | beanmachine-main | tests/ppl/compiler/bmt_model_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from beanmachine.ppl.compiler.broadcaster import broadcast_fnc
from torch import Size
class BroadcastTest(unittest.TestCa... | beanmachine-main | tests/ppl/compiler/broadcaster_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for patterns.py"""
import ast
import re
import unittest
from beanmachine.ppl.compiler.ast_patterns import (
ast_str,
binop... | beanmachine-main | tests/ppl/compiler/patterns_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference import BMGInference
from torch import exp, log, lo... | beanmachine-main | tests/ppl/compiler/fix_logsumexp_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference import BMGInference
from torch.distributions impor... | beanmachine-main | tests/ppl/compiler/fix_logaddexp_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for tutorial on Robust Linear Regression"""
# This file is a manual replica of the Bento tutorial with the same name
##... | beanmachine-main | tests/ppl/compiler/tutorial_Robust_Linear_Regression_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# BM -> BMG compiler arithmetic tests
import math
import operator
import unittest
import beanmachine.ppl as bm
impo... | beanmachine-main | tests/ppl/compiler/bmg_arithmetic_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.compiler.gen_bmg_gra... | beanmachine-main | tests/ppl/compiler/fix_matrix_type_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Bernoulli compiler tests
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGIn... | beanmachine-main | tests/ppl/compiler/bernoulli_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
import torch.distributions as dist
from beanmachine.ppl.inference import BMGInfer... | beanmachine-main | tests/ppl/compiler/annotated_assignment_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Categorical compiler tests
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMG... | beanmachine-main | tests/ppl/compiler/categorical_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.runtime import BMGRuntime
from torch.distributions import Bernou... | beanmachine-main | tests/ppl/compiler/node_context_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compare original and conjugate prior transformed model"""
import random
import unittest
import scipy
import torch
from beanmachine.ppl.... | beanmachine-main | tests/ppl/compiler/fix_normal_normal_basic_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end compiler test for Bayesian Meta-Analysis model"""
import platform
import unittest
import beanmachine.ppl as bm
from beanmach... | beanmachine-main | tests/ppl/compiler/bma_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.gen_dot import to_dot
from beanmachine.ppl.compiler.runtime impo... | beanmachine-main | tests/ppl/compiler/stochastic_control_flow_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for log1mexp"""
import math
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference.bmg... | beanmachine-main | tests/ppl/compiler/log1mexp_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_inference import BMGInference
from torch.distributions impo... | beanmachine-main | tests/ppl/compiler/boolean_comparisons_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from torch import tensor
from torch.distrib... | beanmachine-main | tests/ppl/compiler/fix_observe_true_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from torch.distributions import Bernoulli, ... | beanmachine-main | tests/ppl/compiler/fix_multiary_ops_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.gen_dot import to_dot
from beanmachine.ppl.compiler.runtime impo... | beanmachine-main | tests/ppl/compiler/tensor_operations_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Beta-Bernoulli model conjugacy transformation check when
hyperparameter is a random variable."""
import unittest
import beanmachine.... | beanmachine-main | tests/ppl/compiler/fix_beta_bernoulli_alpha_rv_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.copy_and_replace import copy_and_replace
from beanmachine.ppl.c... | beanmachine-main | tests/ppl/compiler/tensorize_transformer_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from torch import tensor
from torch.distrib... | beanmachine-main | tests/ppl/compiler/broadcast_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference.bmg_inference import BMGInference
from torch import tensor
from... | beanmachine-main | tests/ppl/compiler/gen_mini_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from beanmachine.ppl.compiler.bm_graph_builder import BMGraphBuilder
from beanmachine.ppl.compiler.gen_dot import to_dot
f... | beanmachine-main | tests/ppl/compiler/fix_if_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test for tutorial on Neal's Funnel"""
# This file is a manual replica of the Bento tutorial with the same name
# This is a blo... | beanmachine-main | tests/ppl/compiler/tutorial_Neals_Funnel_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""End-to-end test of realistic linear regression model"""
# This is copied from bento workbook N140350, simplified, and
# modified to use ... | beanmachine-main | tests/ppl/compiler/linear_regression_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compilation test of Todd's Linear Regression Outliers Marginalized model"""
import unittest
import beanmachine.ppl as bm
from beanmachin... | beanmachine-main | tests/ppl/compiler/lromm_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import platform
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.inference import BMGInference
from torch import exp, log
... | beanmachine-main | tests/ppl/compiler/fix_logsumexp_perf_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference import BMGInference
from torch.distributions impor... | beanmachine-main | tests/ppl/compiler/fix_matrix_scale_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
import scipy
from beanmachine.ppl.inference import BMGInference
from torch.distributions impor... | beanmachine-main | tests/ppl/compiler/disable_transformations_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Compare original and conjugate prior transformed
Beta-Binomial model"""
import random
import unittest
import beanmachine.ppl as bm
i... | beanmachine-main | tests/ppl/compiler/fix_beta_binomial_basic_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for bm_to_bmg.py"""
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.gen_bmg_graph import to_bmg_graph
f... | beanmachine-main | tests/ppl/compiler/graph_accumulation_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.gen_bmg_cpp import to_bmg_cpp
from beanmachine.ppl.compiler.gen_... | beanmachine-main | tests/ppl/compiler/lse_vector_test.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from typing import Any
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.runtime import BMGRuntime
from beanmachin... | beanmachine-main | tests/ppl/compiler/support_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Dirichlet compiler tests
import unittest
import beanmachine.ppl as bm
from beanmachine.graph import (
AtomicT... | beanmachine-main | tests/ppl/compiler/dirichlet_test.py |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Dirichlet compiler tests
import unittest
import beanmachine.ppl as bm
import torch
from beanmachine.ppl.inference... | beanmachine-main | tests/ppl/compiler/cholesky_test.py |
beanmachine-main | tests/ppl/compiler/testlib/__init__.py | |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict
import beanmachine.ppl as bm
import torch.distributions as dist
from beanmachine.ppl.model.rv_identifier import RVI... | beanmachine-main | tests/ppl/compiler/testlib/conjugate_models.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.