<jupyter_start><jupyter_text>Check if model converges at all<jupyter_code>%load_ext autoreload
import os, sys, importlib
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split

import tensorflow as tf

BASE_PATH = os.path.join(os.getcwd(), "..", "..", "..")
MODULE_PATH = os.path.join(BASE_PATH, "modules")
DATASETS_PATH = os.path.join(BASE_PATH, "datasets")

sys.path.append(MODULE_PATH)

from active_learning import TrainConfig
from data import BenchmarkData, DataSetType
from models import setup_growth, default_model
from bayesian import BayesModel, McDropout, MomentPropagation

import mp.MomentPropagation as mp
setup_growth()
output_classes = 5
benchmark = BenchmarkData(DataSetType.MNIST, os.path.join(DATASETS_PATH, "mnist"), classes=output_classes)
x_train, x_test, y_train, y_test = train_test_split(benchmark.inputs, benchmark.targets)
print("Datapoints: {}".format(len(benchmark.targets)))
print("Unique labels: {}".format(np.unique(benchmark.targets)))
model = default_model(output_classes=output_classes)
model.compile(optimizer="adadelta", loss="sparse_categorical_crossentropy", metrics=["accuracy"])
x_test.shape
y_test.shape
model.fit(x_train, y_train, epochs=10, batch_size=100)
model.evaluate(x_test, y_test)<jupyter_output>280/280 [==============================] - 3s 12ms/step - loss: 1.1440 - accuracy: 0.3214<jupyter_text>Model Debug<jupyter_code>mc_model = McDropout(model)
mc_model.evaluate(x_test[:100], y_test[:100])
model.evaluate(x_test[:100], y_test[:100])
mc_model.fit(x_train, y_train, epochs=100, batch_size=100)
mc_model.get_model().evaluate(x_test[:100], y_test[:100])
mc_model.evaluate(x_test[:100], y_test[:100])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1433466590519703, 'fraction_numerical': 0.03141062250142775, 'mean_word_length': 8.626373626373626, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '278034', 'license': 'MIT', 'n_tokens_mistral': 668, 'n_tokens_neox': 609, 'n_words': 116, 'path': 'wp/notebooks/model/mc_dropout/debug.ipynb', 'repo_name': 'ExLeonem/master-thesis-code', 'size': '1751'}