from sklearn.model_selection import train_test_split from spn.algorithms.LearningWrappers import learn_parametric from spn.algorithms.Sampling import sample_instances from spn.algorithms.Statistics import get_structure_stats, get_structure_stats_dict # from spn.structure.Base import Context from new_base import Context from spn.structure.leaves.parametric.Parametric import CategoricalDictionary, Categorical, Gaussian from ScikitCSPNClassifier import CSPNClassifier from experiments.img_tools import get_blocks, stitch_imgs, show_img, save_img from structure.Conditional.Inference import add_conditional_inference_support from structure.Conditional.Sampling import add_conditional_sampling_support from structure.Conditional.utils import concatenate_yx add_conditional_sampling_support() add_conditional_inference_support() def to_ohe(x, n_values): return np.eye(n_values)[x] output_path = os.path.dirname(os.path.abspath(__file__)) + '/imgs_pixelcspn_faces/' faces = fetch_olivetti_faces() data = fetch_olivetti_faces() images = np.round(data['images'] * 256).astype(dtype=np.uint8) target = data['target'] np.random.seed(1) X_train, X_test, y_train, y_test = train_test_split(images, target)
def setUp(self): add_conditional_inference_support()
def setUp(self): add_conditional_inference_support() add_conditional_mpe_support() add_conditional_sampling_support()