Exemplo n.º 1
0
def test_can_pass_scalar_to_vertex(jvm_view: JVMView) -> None:
    gaussian = Vertex(jvm_view.GaussianVertex, 0., 1.)
    sample = gaussian.sample()

    assert type(sample) == numpy_types
    assert sample.shape == ()
    assert sample.dtype == float
Exemplo n.º 2
0
def test_can_pass_vertex_to_vertex(jvm_view: JVMView) -> None:
    mu = Gaussian(0., 1.)
    gaussian = Vertex(jvm_view.GaussianVertex, "gaussian", mu, Const(1.))
    sample = gaussian.sample()

    assert type(sample) == numpy_types
    assert sample.shape == ()
    assert sample.dtype == float
Exemplo n.º 3
0
def test_can_pass_array_to_vertex(jvm_view: JVMView) -> None:
    gaussian = Vertex(jvm_view.GaussianVertex, "gaussian", [3, 3], Const(0.),
                      Const(1.))
    sample = gaussian.sample()

    assert sample.shape == (3, 3)
Exemplo n.º 4
0
def test_can_pass_array_to_vertex(jvm_view: JVMView) -> None:
    gaussian = Vertex(jvm_view.GaussianVertex, [3, 3], 0., 1.)
    sample = gaussian.sample()

    assert sample.shape == (3, 3)
Exemplo n.º 5
0
def test_can_pass_pandas_series_to_vertex(jvm_view):
    gaussian = Vertex(jvm_view.GaussianVertex, pd.Series(data=[0.1, 0.4]),
                      pd.Series(data=[0.1, 0.4]))
    sample = gaussian.sample()

    assert sample.shape == (2, )
Exemplo n.º 6
0
def test_can_pass_pandas_dataframe_to_vertex(jvm_view: JVMView) -> None:
    gaussian = Vertex(jvm_view.GaussianVertex, pd.DataFrame(data=[0.1, 0.4]),
                      pd.DataFrame(data=[0.1, 0.4]))
    sample = gaussian.sample()

    assert sample.shape == (2, 1)
Exemplo n.º 7
0
def test_can_pass_ndarray_to_vertex(jvm_view: JVMView) -> None:
    gaussian = Vertex(jvm_view.GaussianVertex, np.array([0.1, 0.4]),
                      np.array([0.4, 0.5]))
    sample = gaussian.sample()

    assert sample.shape == (2, )