diff --git a/README.md b/README.md
index 6a9f783..6f8f955 100644
--- a/README.md
+++ b/README.md
@@ -25,4 +25,6 @@ Eingabe Ausgabe
\aclu{ecu} European currency unit
-https://www.kaggle.com/datasets/lakritidis/product-classification-and-categorization
\ No newline at end of file
+https://www.kaggle.com/datasets/lakritidis/product-classification-and-categorization
+
+https://medium.com/analytics-vidhya/classification-using-long-short-term-memory-glove-global-vectors-for-word-representation-254d02d5e158
\ No newline at end of file
diff --git a/fetchDatafromDb/getProductDetails.ipynb b/fetchDatafromDb/getProductDetails.ipynb
index d8916f5..36558b4 100644
--- a/fetchDatafromDb/getProductDetails.ipynb
+++ b/fetchDatafromDb/getProductDetails.ipynb
@@ -1,5 +1,48 @@
{
"cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 56,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "16053.39s - pydevd: Sending message related to process being replaced timed-out after 5 seconds\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Defaulting to user installation because normal site-packages is not writeable\n",
+ "Collecting seaborn\n",
+ " Downloading seaborn-0.12.2-py3-none-any.whl (293 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m293.3/293.3 KB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hRequirement already satisfied: matplotlib!=3.6.1,>=3.1 in /home/shoney/.local/lib/python3.10/site-packages (from seaborn) (3.7.1)\n",
+ "Requirement already satisfied: numpy!=1.24.0,>=1.17 in /home/shoney/.local/lib/python3.10/site-packages (from seaborn) (1.24.3)\n",
+ "Requirement already satisfied: pandas>=0.25 in /home/shoney/.local/lib/python3.10/site-packages (from seaborn) (2.0.2)\n",
+ "Requirement already satisfied: cycler>=0.10 in /home/shoney/.local/lib/python3.10/site-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (0.11.0)\n",
+ "Requirement already satisfied: kiwisolver>=1.0.1 in /home/shoney/.local/lib/python3.10/site-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (1.4.4)\n",
+ "Requirement already satisfied: fonttools>=4.22.0 in /home/shoney/.local/lib/python3.10/site-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (4.39.4)\n",
+ "Requirement already satisfied: packaging>=20.0 in /home/shoney/.local/lib/python3.10/site-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (23.1)\n",
+ "Requirement already satisfied: python-dateutil>=2.7 in /home/shoney/.local/lib/python3.10/site-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (2.8.2)\n",
+ "Requirement already satisfied: contourpy>=1.0.1 in /home/shoney/.local/lib/python3.10/site-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (1.0.7)\n",
+ "Requirement already satisfied: pyparsing>=2.3.1 in /usr/lib/python3/dist-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (2.4.7)\n",
+ "Requirement already satisfied: pillow>=6.2.0 in /home/shoney/.local/lib/python3.10/site-packages (from matplotlib!=3.6.1,>=3.1->seaborn) (9.5.0)\n",
+ "Requirement already satisfied: pytz>=2020.1 in /home/shoney/.local/lib/python3.10/site-packages (from pandas>=0.25->seaborn) (2023.3)\n",
+ "Requirement already satisfied: tzdata>=2022.1 in /home/shoney/.local/lib/python3.10/site-packages (from pandas>=0.25->seaborn) (2023.3)\n",
+ "Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7->matplotlib!=3.6.1,>=3.1->seaborn) (1.16.0)\n",
+ "Installing collected packages: seaborn\n",
+ "Successfully installed seaborn-0.12.2\n"
+ ]
+ }
+ ],
+ "source": [
+ "!python3 -m pip install seaborn"
+ ]
+ },
{
"cell_type": "code",
"execution_count": 54,
@@ -91,21 +134,9 @@
},
{
"cell_type": "code",
- "execution_count": 55,
+ "execution_count": 57,
"metadata": {},
- "outputs": [
- {
- "ename": "ModuleNotFoundError",
- "evalue": "No module named 'seaborn'",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
- "Cell \u001b[0;32mIn[55], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39msklearn\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mmatplotlib\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mpyplot\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mplt\u001b[39;00m\n\u001b[0;32m----> 7\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mseaborn\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39msns\u001b[39;00m\n",
- "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'seaborn'"
- ]
- }
- ],
+ "outputs": [],
"source": [
"import pandas as pd\n",
"import re\n",
@@ -491,12 +522,529 @@
"df_eng.shape"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 58,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df_eng = df_eng.dropna()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 59,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(10, 9)"
+ ]
+ },
+ "execution_count": 59,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df_eng.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 60,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " name | \n",
+ " sdesc | \n",
+ " category | \n",
+ " catlevel0 | \n",
+ " catlevel1 | \n",
+ " catlevel2 | \n",
+ " catlevel3 | \n",
+ " catlevel4 | \n",
+ " catlevel5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " denso dtm82363 thermostat coolant | \n",
+ " thermostat coolant | \n",
+ " thermostat | \n",
+ " SparePart | \n",
+ " Cooling System | \n",
+ " Thermostat | \n",
+ " na | \n",
+ " na | \n",
+ " na | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " zf 1043 010 297 automatic transmission | \n",
+ " automatic transmission | \n",
+ " automatic transmission | \n",
+ " SparePart | \n",
+ " Transmission | \n",
+ " Automatic Transmission | \n",
+ " Automatic Transmission | \n",
+ " na | \n",
+ " na | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " zf 1060 040 003 automatic transmission | \n",
+ " automatic transmission | \n",
+ " automatic transmission | \n",
+ " SparePart | \n",
+ " Transmission | \n",
+ " Automatic Transmission | \n",
+ " Automatic Transmission | \n",
+ " na | \n",
+ " na | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " vaico v10 0131 camshaft | \n",
+ " camshaft | \n",
+ " camshaft | \n",
+ " SparePart | \n",
+ " Engine | \n",
+ " Engine Timing | \n",
+ " Camshaft | \n",
+ " na | \n",
+ " na | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " vaico v26 0302 track control arm | \n",
+ " track control arm | \n",
+ " track control arm | \n",
+ " SparePart | \n",
+ " Powertrain & Suspension | \n",
+ " Wheel Suspension | \n",
+ " Track Control Arm | \n",
+ " na | \n",
+ " na | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " name sdesc \\\n",
+ "0 denso dtm82363 thermostat coolant thermostat coolant \n",
+ "1 zf 1043 010 297 automatic transmission automatic transmission \n",
+ "2 zf 1060 040 003 automatic transmission automatic transmission \n",
+ "3 vaico v10 0131 camshaft camshaft \n",
+ "4 vaico v26 0302 track control arm track control arm \n",
+ "\n",
+ " category catlevel0 catlevel1 \\\n",
+ "0 thermostat SparePart Cooling System \n",
+ "1 automatic transmission SparePart Transmission \n",
+ "2 automatic transmission SparePart Transmission \n",
+ "3 camshaft SparePart Engine \n",
+ "4 track control arm SparePart Powertrain & Suspension \n",
+ "\n",
+ " catlevel2 catlevel3 catlevel4 catlevel5 \n",
+ "0 Thermostat na na na \n",
+ "1 Automatic Transmission Automatic Transmission na na \n",
+ "2 Automatic Transmission Automatic Transmission na na \n",
+ "3 Engine Timing Camshaft na na \n",
+ "4 Wheel Suspension Track Control Arm na na "
+ ]
+ },
+ "execution_count": 60,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df_eng.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 61,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " name | \n",
+ " sdesc | \n",
+ " category | \n",
+ " catlevel0 | \n",
+ " catlevel1 | \n",
+ " catlevel2 | \n",
+ " catlevel3 | \n",
+ " catlevel4 | \n",
+ " catlevel5 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | count | \n",
+ " 10 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ "
\n",
+ " \n",
+ " | unique | \n",
+ " 10 | \n",
+ " 9 | \n",
+ " 9 | \n",
+ " 1 | \n",
+ " 5 | \n",
+ " 6 | \n",
+ " 8 | \n",
+ " 1 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | top | \n",
+ " denso dtm82363 thermostat coolant | \n",
+ " automatic transmission | \n",
+ " automatic transmission | \n",
+ " SparePart | \n",
+ " Powertrain & Suspension | \n",
+ " Automatic Transmission | \n",
+ " na | \n",
+ " na | \n",
+ " na | \n",
+ "
\n",
+ " \n",
+ " | freq | \n",
+ " 1 | \n",
+ " 2 | \n",
+ " 2 | \n",
+ " 10 | \n",
+ " 4 | \n",
+ " 3 | \n",
+ " 2 | \n",
+ " 10 | \n",
+ " 10 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " name sdesc \\\n",
+ "count 10 10 \n",
+ "unique 10 9 \n",
+ "top denso dtm82363 thermostat coolant automatic transmission \n",
+ "freq 1 2 \n",
+ "\n",
+ " category catlevel0 catlevel1 \\\n",
+ "count 10 10 10 \n",
+ "unique 9 1 5 \n",
+ "top automatic transmission SparePart Powertrain & Suspension \n",
+ "freq 2 10 4 \n",
+ "\n",
+ " catlevel2 catlevel3 catlevel4 catlevel5 \n",
+ "count 10 10 10 10 \n",
+ "unique 6 8 1 1 \n",
+ "top Automatic Transmission na na na \n",
+ "freq 3 2 10 10 "
+ ]
+ },
+ "execution_count": 61,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df_eng.describe()"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "One hot encoding "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 62,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " name | \n",
+ " sdesc | \n",
+ " catlevel0 | \n",
+ " catlevel1 | \n",
+ " catlevel2 | \n",
+ " catlevel3 | \n",
+ " catlevel4 | \n",
+ " catlevel5 | \n",
+ " category_automatic transmission | \n",
+ " category_camshaft | \n",
+ " category_mounting | \n",
+ " category_shock absorber | \n",
+ " category_suspension kit | \n",
+ " category_tensioner pulley | \n",
+ " category_thermostat | \n",
+ " category_track control arm | \n",
+ " category_wheel hub | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " denso dtm82363 thermostat coolant | \n",
+ " thermostat coolant | \n",
+ " SparePart | \n",
+ " Cooling System | \n",
+ " Thermostat | \n",
+ " na | \n",
+ " na | \n",
+ " na | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " True | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " zf 1043 010 297 automatic transmission | \n",
+ " automatic transmission | \n",
+ " SparePart | \n",
+ " Transmission | \n",
+ " Automatic Transmission | \n",
+ " Automatic Transmission | \n",
+ " na | \n",
+ " na | \n",
+ " True | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " zf 1060 040 003 automatic transmission | \n",
+ " automatic transmission | \n",
+ " SparePart | \n",
+ " Transmission | \n",
+ " Automatic Transmission | \n",
+ " Automatic Transmission | \n",
+ " na | \n",
+ " na | \n",
+ " True | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " vaico v10 0131 camshaft | \n",
+ " camshaft | \n",
+ " SparePart | \n",
+ " Engine | \n",
+ " Engine Timing | \n",
+ " Camshaft | \n",
+ " na | \n",
+ " na | \n",
+ " False | \n",
+ " True | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " vaico v26 0302 track control arm | \n",
+ " track control arm | \n",
+ " SparePart | \n",
+ " Powertrain & Suspension | \n",
+ " Wheel Suspension | \n",
+ " Track Control Arm | \n",
+ " na | \n",
+ " na | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " False | \n",
+ " True | \n",
+ " False | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " name sdesc catlevel0 \\\n",
+ "0 denso dtm82363 thermostat coolant thermostat coolant SparePart \n",
+ "1 zf 1043 010 297 automatic transmission automatic transmission SparePart \n",
+ "2 zf 1060 040 003 automatic transmission automatic transmission SparePart \n",
+ "3 vaico v10 0131 camshaft camshaft SparePart \n",
+ "4 vaico v26 0302 track control arm track control arm SparePart \n",
+ "\n",
+ " catlevel1 catlevel2 catlevel3 \\\n",
+ "0 Cooling System Thermostat na \n",
+ "1 Transmission Automatic Transmission Automatic Transmission \n",
+ "2 Transmission Automatic Transmission Automatic Transmission \n",
+ "3 Engine Engine Timing Camshaft \n",
+ "4 Powertrain & Suspension Wheel Suspension Track Control Arm \n",
+ "\n",
+ " catlevel4 catlevel5 category_automatic transmission category_camshaft \\\n",
+ "0 na na False False \n",
+ "1 na na True False \n",
+ "2 na na True False \n",
+ "3 na na False True \n",
+ "4 na na False False \n",
+ "\n",
+ " category_mounting category_shock absorber category_suspension kit \\\n",
+ "0 False False False \n",
+ "1 False False False \n",
+ "2 False False False \n",
+ "3 False False False \n",
+ "4 False False False \n",
+ "\n",
+ " category_tensioner pulley category_thermostat category_track control arm \\\n",
+ "0 False True False \n",
+ "1 False False False \n",
+ "2 False False False \n",
+ "3 False False False \n",
+ "4 False False True \n",
+ "\n",
+ " category_wheel hub \n",
+ "0 False \n",
+ "1 False \n",
+ "2 False \n",
+ "3 False \n",
+ "4 False "
+ ]
+ },
+ "execution_count": 62,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df_eng = pd.get_dummies(df_eng,columns=[\"category\"])\n",
+ "df_eng.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 63,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(10, 17)"
+ ]
+ },
+ "execution_count": 63,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df_eng.shape"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "from sklearn.model_selection import train_test_split\n",
+ "\n"
+ ]
}
],
"metadata": {