doc
This commit is contained in:
parent
e67996d2c9
commit
9196a7e495
4 changed files with 159 additions and 664 deletions
|
|
@ -1,3 +1,21 @@
|
|||
\chapter{Training a classification model}
|
||||
|
||||
One of the major challenge in an ecommerce industry is to categorize the products. The phenominal types of products in the ecommerce web application sold online may require an artificial inteligence generated category tree. The multi level product-categories in the taxonomy tree received and defined from the suppliers or manfucture may not be usable. Since the existing multi level category of those products in ecommerse application may defer. Importing product-category details directly from the various channels may lead to disambugution. The artificial inteligence generated category tree reduces the product ready to deploy time on the production environment. The product ready to deploy time here refers to the check lists of data correctness of the product before listing online.
|
||||
|
||||
\section {Fetch existing product taxonomy using Elastic Search}
|
||||
|
||||
In section \ref {pyenv}, version specific python client installation detail are documented. For this project, python client elasticsearch 6.8.2 is installed as the client needs to be compatble with Elastic search version being used.
|
||||
|
||||
|
||||
\begin{lstlisting}[language=Python]
|
||||
from elasticsearch import Elasticsearch
|
||||
client = Elasticsearch("http://localhost:9200")
|
||||
|
||||
resp = client.search(index="development_products",
|
||||
body={"_source":["descriptions","descriptionsSource","nameSource","shortDescriptionSource","categoriesSource"],
|
||||
"query": {"match_all": {}}})
|
||||
\end{lstlisting}
|
||||
|
||||
The above code sample fetches the features of the product such as "name","description",category".
|
||||
|
||||
\section {Normalization of text.}
|
||||
|
|
@ -2,6 +2,24 @@
|
|||
|
||||
\section {Ubuntu server 20.04 configuration}
|
||||
|
||||
\section {Python virtual environment}
|
||||
\section {Python virtual environment} \label {pyenv}
|
||||
|
||||
pyenv facilitaes to isolate python version dependent source codes and avoid version conflicts. A virtual environment will install packages to a specific python module instad of installing globally. Asuming the directrory root directory name is "dev", follow linux bash code to activate virtual environment.
|
||||
The bash script below will create and activate virtual environment and all the packages will be installed within the venv directory
|
||||
\begin{lstlisting}[language=bash]
|
||||
pyenv install 3.10 /
|
||||
cd ~/dev /
|
||||
pyenv local 3.10 /
|
||||
python -m venv .venv /
|
||||
source .venv/bin/activate
|
||||
|
||||
\end{lstlisting}
|
||||
|
||||
Compatible python clients to interact with project dependent module installation can be installed by specifying the version range.
|
||||
Python Elastic search client's official low version installation details are mentioned on elasticsearch-py \footnote{https://elasticsearch-py.readthedocs.io/en/6.8.2/} website.
|
||||
|
||||
\begin{lstlisting}[language=Python]
|
||||
python -m pip install "elasticsearch>=6.4.0,<7.0.0"
|
||||
\end{lstlisting}
|
||||
|
||||
\section {Docker containers - CouchDB, Elastic search, Redis}
|
||||
|
|
@ -9,6 +9,34 @@
|
|||
\usepackage[inkscapeformat=png]{svg}
|
||||
\usepackage{array}
|
||||
\usepackage{mathtools}
|
||||
\usepackage{listings}
|
||||
\usepackage{xcolor}
|
||||
|
||||
\definecolor{codegreen}{rgb}{0,0.6,0}
|
||||
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
|
||||
\definecolor{codepurple}{rgb}{0.58,0,0.82}
|
||||
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
|
||||
|
||||
\lstdefinestyle{mystyle}{
|
||||
backgroundcolor=\color{backcolour},
|
||||
commentstyle=\color{codegreen},
|
||||
keywordstyle=\color{magenta},
|
||||
numberstyle=\tiny\color{codegray},
|
||||
stringstyle=\color{codepurple},
|
||||
basicstyle=\ttfamily\footnotesize,
|
||||
breakatwhitespace=false,
|
||||
breaklines=true,
|
||||
captionpos=b,
|
||||
keepspaces=true,
|
||||
numbers=left,
|
||||
numbersep=5pt,
|
||||
showspaces=false,
|
||||
showstringspaces=false,
|
||||
showtabs=false,
|
||||
tabsize=2
|
||||
}
|
||||
|
||||
\lstset{style=mystyle}
|
||||
|
||||
\graphicspath{ {images/} }
|
||||
\addbibresource{References.bib}
|
||||
|
|
|
|||
|
|
@ -2,114 +2,30 @@
|
|||
"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,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"15865.52s - 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 scikit-learn\n",
|
||||
" Downloading scikit_learn-1.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.6 MB)\n",
|
||||
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.6/9.6 MB\u001b[0m \u001b[31m3.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
|
||||
"\u001b[?25hRequirement already satisfied: numpy>=1.17.3 in /home/shoney/.local/lib/python3.10/site-packages (from scikit-learn) (1.24.3)\n",
|
||||
"Collecting scipy>=1.3.2\n",
|
||||
" Downloading scipy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.4 MB)\n",
|
||||
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m34.4/34.4 MB\u001b[0m \u001b[31m6.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
|
||||
"\u001b[?25hCollecting joblib>=1.1.1\n",
|
||||
" Downloading joblib-1.2.0-py3-none-any.whl (297 kB)\n",
|
||||
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m298.0/298.0 KB\u001b[0m \u001b[31m6.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
|
||||
"\u001b[?25hCollecting threadpoolctl>=2.0.0\n",
|
||||
" Downloading threadpoolctl-3.1.0-py3-none-any.whl (14 kB)\n",
|
||||
"Installing collected packages: threadpoolctl, scipy, joblib, scikit-learn\n",
|
||||
"Successfully installed joblib-1.2.0 scikit-learn-1.2.2 scipy-1.10.1 threadpoolctl-3.1.0\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!python3 -m pip install scikit-learn"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"True"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from elasticsearch import Elasticsearch\n",
|
||||
"client = Elasticsearch(\"http://localhost:9200\")\n",
|
||||
"client.info()\n",
|
||||
"client.ping()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!python -m pip install seaborn"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!python -m pip install scikit-learn"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from elasticsearch import Elasticsearch\n",
|
||||
"client = Elasticsearch(\"http://localhost:9200\")\n",
|
||||
"resp = client.search(index=\"retromotion-indexer_development_products\",\n",
|
||||
" body={\"_source\":[\"descriptions\",\"descriptionsSource\",\"nameSource\",\"shortDescriptionSource\",\"categoriesSource\"],\n",
|
||||
" \"query\": {\"match_all\": {}}})\n"
|
||||
|
|
@ -119,6 +35,15 @@
|
|||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
|
|
@ -134,7 +59,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 57,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -149,7 +74,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -159,7 +84,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
|
@ -205,7 +130,7 @@
|
|||
"Index: []"
|
||||
]
|
||||
},
|
||||
"execution_count": 34,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -216,7 +141,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -240,7 +165,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -251,7 +176,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 49,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -321,7 +246,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -341,7 +266,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 50,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
|
@ -382,89 +307,77 @@
|
|||
" <td>denso dtm82363 thermostat coolant</td>\n",
|
||||
" <td>thermostat coolant</td>\n",
|
||||
" <td>thermostat</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Cooling System</td>\n",
|
||||
" <td>Thermostat</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>sparepart</td>\n",
|
||||
" <td>cooling system</td>\n",
|
||||
" <td>thermostat</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>zf 1043 010 297 automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>sparepart</td>\n",
|
||||
" <td>transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>zf 1060 040 003 automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>sparepart</td>\n",
|
||||
" <td>transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>vaico v10 0131 camshaft</td>\n",
|
||||
" <td>camshaft</td>\n",
|
||||
" <td>camshaft</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Engine</td>\n",
|
||||
" <td>Engine Timing</td>\n",
|
||||
" <td>Camshaft</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>sparepart</td>\n",
|
||||
" <td>engine</td>\n",
|
||||
" <td>engine timing</td>\n",
|
||||
" <td>camshaft</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>vaico v26 0302 track control arm</td>\n",
|
||||
" <td>track control arm</td>\n",
|
||||
" <td>track control arm</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Powertrain & Suspension</td>\n",
|
||||
" <td>Wheel Suspension</td>\n",
|
||||
" <td>Track Control Arm</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>sparepart</td>\n",
|
||||
" <td>powertrain suspension</td>\n",
|
||||
" <td>wheel suspension</td>\n",
|
||||
" <td>track control arm</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" <td>NaN</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"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",
|
||||
" name ... catlevel5\n",
|
||||
"0 denso dtm82363 thermostat coolant ... NaN\n",
|
||||
"1 zf 1043 010 297 automatic transmission ... NaN\n",
|
||||
"2 zf 1060 040 003 automatic transmission ... NaN\n",
|
||||
"3 vaico v10 0131 camshaft ... NaN\n",
|
||||
"4 vaico v26 0302 track control arm ... NaN\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 "
|
||||
"[5 rows x 9 columns]"
|
||||
]
|
||||
},
|
||||
"execution_count": 50,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -475,56 +388,25 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 51,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"name 0\n",
|
||||
"sdesc 0\n",
|
||||
"category 0\n",
|
||||
"catlevel0 0\n",
|
||||
"catlevel1 0\n",
|
||||
"catlevel2 0\n",
|
||||
"catlevel3 6\n",
|
||||
"catlevel4 30\n",
|
||||
"catlevel5 30\n",
|
||||
"dtype: int64"
|
||||
]
|
||||
},
|
||||
"execution_count": 51,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_eng.isna().sum()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 52,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(40, 9)"
|
||||
]
|
||||
},
|
||||
"execution_count": 52,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_eng.shape"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 58,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -533,273 +415,27 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 59,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(10, 9)"
|
||||
]
|
||||
},
|
||||
"execution_count": 59,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_eng.shape"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 60,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>name</th>\n",
|
||||
" <th>sdesc</th>\n",
|
||||
" <th>category</th>\n",
|
||||
" <th>catlevel0</th>\n",
|
||||
" <th>catlevel1</th>\n",
|
||||
" <th>catlevel2</th>\n",
|
||||
" <th>catlevel3</th>\n",
|
||||
" <th>catlevel4</th>\n",
|
||||
" <th>catlevel5</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>denso dtm82363 thermostat coolant</td>\n",
|
||||
" <td>thermostat coolant</td>\n",
|
||||
" <td>thermostat</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Cooling System</td>\n",
|
||||
" <td>Thermostat</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>zf 1043 010 297 automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>zf 1060 040 003 automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>vaico v10 0131 camshaft</td>\n",
|
||||
" <td>camshaft</td>\n",
|
||||
" <td>camshaft</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Engine</td>\n",
|
||||
" <td>Engine Timing</td>\n",
|
||||
" <td>Camshaft</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>vaico v26 0302 track control arm</td>\n",
|
||||
" <td>track control arm</td>\n",
|
||||
" <td>track control arm</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Powertrain & Suspension</td>\n",
|
||||
" <td>Wheel Suspension</td>\n",
|
||||
" <td>Track Control Arm</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_eng.head()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 61,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>name</th>\n",
|
||||
" <th>sdesc</th>\n",
|
||||
" <th>category</th>\n",
|
||||
" <th>catlevel0</th>\n",
|
||||
" <th>catlevel1</th>\n",
|
||||
" <th>catlevel2</th>\n",
|
||||
" <th>catlevel3</th>\n",
|
||||
" <th>catlevel4</th>\n",
|
||||
" <th>catlevel5</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>count</th>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>unique</th>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>9</td>\n",
|
||||
" <td>9</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>5</td>\n",
|
||||
" <td>6</td>\n",
|
||||
" <td>8</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>top</th>\n",
|
||||
" <td>denso dtm82363 thermostat coolant</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Powertrain & Suspension</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>freq</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" <td>3</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" <td>10</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_eng.describe()"
|
||||
]
|
||||
|
|
@ -814,203 +450,9 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 62,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>name</th>\n",
|
||||
" <th>sdesc</th>\n",
|
||||
" <th>catlevel0</th>\n",
|
||||
" <th>catlevel1</th>\n",
|
||||
" <th>catlevel2</th>\n",
|
||||
" <th>catlevel3</th>\n",
|
||||
" <th>catlevel4</th>\n",
|
||||
" <th>catlevel5</th>\n",
|
||||
" <th>category_automatic transmission</th>\n",
|
||||
" <th>category_camshaft</th>\n",
|
||||
" <th>category_mounting</th>\n",
|
||||
" <th>category_shock absorber</th>\n",
|
||||
" <th>category_suspension kit</th>\n",
|
||||
" <th>category_tensioner pulley</th>\n",
|
||||
" <th>category_thermostat</th>\n",
|
||||
" <th>category_track control arm</th>\n",
|
||||
" <th>category_wheel hub</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>denso dtm82363 thermostat coolant</td>\n",
|
||||
" <td>thermostat coolant</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Cooling System</td>\n",
|
||||
" <td>Thermostat</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>zf 1043 010 297 automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>zf 1060 040 003 automatic transmission</td>\n",
|
||||
" <td>automatic transmission</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>Automatic Transmission</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>vaico v10 0131 camshaft</td>\n",
|
||||
" <td>camshaft</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Engine</td>\n",
|
||||
" <td>Engine Timing</td>\n",
|
||||
" <td>Camshaft</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>vaico v26 0302 track control arm</td>\n",
|
||||
" <td>track control arm</td>\n",
|
||||
" <td>SparePart</td>\n",
|
||||
" <td>Powertrain & Suspension</td>\n",
|
||||
" <td>Wheel Suspension</td>\n",
|
||||
" <td>Track Control Arm</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>na</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" <td>False</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_eng = pd.get_dummies(df_eng,columns=[\"category\"])\n",
|
||||
"df_eng.head()"
|
||||
|
|
@ -1018,20 +460,9 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 63,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(10, 17)"
|
||||
]
|
||||
},
|
||||
"execution_count": 63,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_eng.shape"
|
||||
]
|
||||
|
|
@ -1063,7 +494,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.6"
|
||||
"version": "3.9.7"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue