{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "19f0029a", "metadata": {}, "outputs": [], "source": [ "from sklearn.datasets import make_classification\n", "\n", "# Not everything from this is used\n", "\n", "import numpy as np\n", "import pandas as pd\n", "from sklearn.datasets import fetch_openml\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.metrics import accuracy_score, log_loss, ConfusionMatrixDisplay, confusion_matrix\n", "from sklearn.preprocessing import LabelEncoder, StandardScaler\n", "\n", "import os\n", "import wget\n", "from pathlib import Path\n", "import shutil\n", "import gzip\n", "\n", "from matplotlib import pyplot as plt\n", "import seaborn as sns\n", "# Apply the default theme\n", "sns.set_theme(rc={\"patch.force_edgecolor\": False})\n", "\n", "import torch\n", "from pytorch_tabnet.tab_model import TabNetClassifier\n", "from xgboost import XGBClassifier, plot_importance\n", "from lightgbm import LGBMClassifier\n", "from catboost import CatBoostClassifier\n", "from sklearn.ensemble import RandomForestClassifier\n", "\n", "pd.set_option('display.max_columns', None)\n", "\n", "import random\n", "import json" ] }, { "cell_type": "code", "execution_count": null, "id": "e92a6259", "metadata": {}, "outputs": [], "source": [ "X, y = make_classification(\n", " n_samples=100000,\n", " n_features=10,\n", " n_informative=5,\n", " n_redundant=0,\n", " n_repeated=0,\n", " n_classes=2,\n", " class_sep=1,\n", " random_state=0\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "188ade18", "metadata": {}, "outputs": [], "source": [ "data = pd.DataFrame(X, columns = [\"f1\", \"f2\", \"f3\", \"f4\", \"f5\", \"f6\", \"f7\", \"f8\", \"f9\", \"f10\"])\n", "data[\"y\"] = y" ] }, { "cell_type": "code", "execution_count": null, "id": "3317628d", "metadata": {}, "outputs": [], "source": [ "print(data[\"y\"].value_counts())" ] }, { "cell_type": "code", "execution_count": null, "id": "7e64682e", "metadata": {}, "outputs": [], "source": [ "display(data)" ] }, { "cell_type": "code", "execution_count": null, "id": "b3ec059c", "metadata": { "scrolled": true }, "outputs": [], "source": [ "plt.rcParams[\"figure.figsize\"] = (20, 6)\n", "plt.subplot(2, 5, 1)\n", "data[\"f1\"].hist(bins=100)\n", "plt.subplot(2, 5, 2)\n", "data[\"f2\"].hist(bins=100)\n", "plt.subplot(2, 5, 3)\n", "data[\"f3\"].hist(bins=100)\n", "plt.subplot(2, 5, 4)\n", "data[\"f4\"].hist(bins=100)\n", "plt.subplot(2, 5, 5)\n", "data[\"f5\"].hist(bins=100)\n", "plt.subplot(2, 5, 6)\n", "data[\"f6\"].hist(bins=100)\n", "plt.subplot(2, 5, 7)\n", "data[\"f7\"].hist(bins=100)\n", "plt.subplot(2, 5, 8)\n", "data[\"f8\"].hist(bins=100)\n", "plt.subplot(2, 5, 9)\n", "data[\"f9\"].hist(bins=100)\n", "plt.subplot(2, 5, 10)\n", "data[\"f10\"].hist(bins=100)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "83527c89", "metadata": {}, "outputs": [], "source": [ "data.to_pickle(\"../syn10.pkl\")" ] }, { "cell_type": "code", "execution_count": null, "id": "b0e46afb", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.10.6" } }, "nbformat": 4, "nbformat_minor": 5 }