# %% Import packages

from bnn_mcmc_examples.datasets import load_xydataset_from_file
from bnn_mcmc_examples.datasets.noisy_xor.data1.constants import test_data_path, training_data_path
from bnn_mcmc_examples.examples.mlp.noisy_xor.setting1.constants import dtype

# %% Load training dataloader

training_dataset, training_dataloader = load_xydataset_from_file(
    training_data_path, dtype=dtype)

# %% Load test dataloader

test_dataset, test_dataloader = load_xydataset_from_file(test_data_path,
                                                         dtype=dtype)
示例#2
0
# %% Import packages

from bnn_mcmc_examples.datasets import load_xydataset_from_file
from bnn_mcmc_examples.datasets.noisy_xor.data2.constants import test_data_path, training_data_path
from bnn_mcmc_examples.examples.mlp.noisy_xor.setting3.constants import dtype, batch_size, shuffle

# %% Load training dataloader

training_dataset, training_dataloader = load_xydataset_from_file(
    training_data_path, dtype=dtype, batch_size=batch_size, shuffle=shuffle
)

# %% Load test dataloader

test_dataset, test_dataloader = load_xydataset_from_file(test_data_path, dtype=dtype)
示例#3
0
# %% Import packages

import matplotlib.pyplot as plt
import numpy as np

from bnn_mcmc_examples.datasets import load_xydataset_from_file
from bnn_mcmc_examples.datasets.noisy_xor.data1.constants import num_classes, num_test_samples, test_data_path, output_path

# %% Load data

dataset, _ = load_xydataset_from_file(test_data_path)

# %% Create output directory if it does not exist

output_path.mkdir(parents=True, exist_ok=True)

# %% Plot noisy XOR points

num_test_samples_cumsum = np.hstack((0, num_test_samples)).cumsum()

# print(plt.rcParams['axes.prop_cycle'].by_key()['color'])
cols = ['#1f77b4', '#ff7f0e', '#d62728', '#e377c2']

labels = ['(0, 0)', '(0, 1)', '(1, 0)', '(1, 1)']

plt.figure(figsize=[6.4, 6.4])

plt.rcParams['axes.labelsize'] = 14
plt.rcParams['axes.titlesize'] = 14
plt.rcParams['xtick.labelsize'] = 12
plt.rcParams['ytick.labelsize'] = 12
# %% Import packages

import matplotlib.pyplot as plt
import numpy as np

from bnn_mcmc_examples.datasets import load_xydataset_from_file
from bnn_mcmc_examples.datasets.noisy_xor.data2.constants import (
    num_classes, num_training_samples, training_data_path, output_path)

# %% Load data

dataset, _ = load_xydataset_from_file(training_data_path)

# %% Create output directory if it does not exist

output_path.mkdir(parents=True, exist_ok=True)

# %% Plot noisy XOR points

num_training_samples_cumsum = np.hstack((0, num_training_samples)).cumsum()

# print(plt.rcParams['axes.prop_cycle'].by_key()['color'])
cols = ['#1f77b4', '#ff7f0e', '#d62728', '#e377c2']

labels = ['(0, 0)', '(0, 1)', '(1, 0)', '(1, 1)']

plt.figure(figsize=[6.4, 6.4])

plt.rcParams['axes.labelsize'] = 14
plt.rcParams['axes.titlesize'] = 14
plt.rcParams['xtick.labelsize'] = 12
# %% Import packages

from bnn_mcmc_examples.datasets import load_xydataset_from_file
from bnn_mcmc_examples.datasets.noisy_xor.data1.constants import test_data_path
from bnn_mcmc_examples.examples.mlp.noisy_xor.setting1.constants import dtype

# %% Load test dataloader with batch size of 1

test_dataset, test_dataloader = load_xydataset_from_file(test_data_path,
                                                         dtype=dtype,
                                                         batch_size=1)