{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3f63011f-3b37-4b0c-960a-885ec9c594f1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import sys\n",
    "import numpy as np\n",
    "\n",
    "from src.MF_algorithm import MF_model\n",
    "from utils.generate_synthetic import simulation, show_synthetic_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "0706c282-28d1-499f-9ab8-effeec003e05",
   "metadata": {},
   "outputs": [],
   "source": [
    "true_W, true_Q, _, M_clean, M = simulation(200, 100, 10, 10,\n",
    "                                           noise=True, delta=0.1,\n",
    "                                           visualize=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "9fbed366-840d-443b-b23c-af003602ab4e",
   "metadata": {},
   "outputs": [],
   "source": [
    "model = MF_model(M,\n",
    "                 np.ones_like(M),\n",
    "                 10,\n",
    "                 regularizer=1,\n",
    "                 W_upperbd=(True, 1.0),\n",
    "                 Q_upperbd=(True, 100.0),\n",
    "                 M_upperbd=(True, np.max(M)),\n",
    "                 W_beta=0.1, Q_beta=0.1)\n",
    "MF_data = model.decomposition()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "85375ff1-172f-40e3-a727-f04ba5e4fbff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 217872 characters]\n",
      "text/plain": [
       "<Figure size 1200x500 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_synthetic_result(MF_data.W, MF_data.Q, MF_data.M,\n",
    "                      true_W, true_Q)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "35623073-b839-4503-925c-3bdaf6eb47a7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "“deepMF_test”",
   "language": "python",
   "name": "deepmf_test"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
