diff --git a/doc/chapters/chapter2.tex b/doc/chapters/chapter2.tex index 2064d70..947e06f 100644 --- a/doc/chapters/chapter2.tex +++ b/doc/chapters/chapter2.tex @@ -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. \ No newline at end of file +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.} \ No newline at end of file diff --git a/doc/chapters/chapter3.tex b/doc/chapters/chapter3.tex index df3d376..66119e7 100644 --- a/doc/chapters/chapter3.tex +++ b/doc/chapters/chapter3.tex @@ -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} \ No newline at end of file diff --git a/doc/index.tex b/doc/index.tex index 307a589..f377760 100644 --- a/doc/index.tex +++ b/doc/index.tex @@ -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} diff --git a/fetchDatafromDb/getProductDetails.ipynb b/fetchDatafromDb/getProductDetails.ipynb index 36558b4..79e7cc4 100644 --- a/fetchDatafromDb/getProductDetails.ipynb +++ b/fetchDatafromDb/getProductDetails.ipynb @@ -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 @@ " denso dtm82363 thermostat coolant\n", " thermostat coolant\n", " thermostat\n", - " SparePart\n", - " Cooling System\n", - " Thermostat\n", - " na\n", - " na\n", - " na\n", + " sparepart\n", + " cooling system\n", + " thermostat\n", + " NaN\n", + " NaN\n", + " NaN\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", + " sparepart\n", + " transmission\n", + " automatic transmission\n", + " automatic transmission\n", + " NaN\n", + " NaN\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", + " sparepart\n", + " transmission\n", + " automatic transmission\n", + " automatic transmission\n", + " NaN\n", + " NaN\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", + " sparepart\n", + " engine\n", + " engine timing\n", + " camshaft\n", + " NaN\n", + " NaN\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", + " sparepart\n", + " powertrain suspension\n", + " wheel suspension\n", + " track control arm\n", + " NaN\n", + " NaN\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", + " 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": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namesdesccategorycatlevel0catlevel1catlevel2catlevel3catlevel4catlevel5
0denso dtm82363 thermostat coolantthermostat coolantthermostatSparePartCooling SystemThermostatnanana
1zf 1043 010 297 automatic transmissionautomatic transmissionautomatic transmissionSparePartTransmissionAutomatic TransmissionAutomatic Transmissionnana
2zf 1060 040 003 automatic transmissionautomatic transmissionautomatic transmissionSparePartTransmissionAutomatic TransmissionAutomatic Transmissionnana
3vaico v10 0131 camshaftcamshaftcamshaftSparePartEngineEngine TimingCamshaftnana
4vaico v26 0302 track control armtrack control armtrack control armSparePartPowertrain & SuspensionWheel SuspensionTrack Control Armnana
\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" - } - ], + "outputs": [], "source": [ "df_eng.head()" ] }, { "cell_type": "code", - "execution_count": 61, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namesdesccategorycatlevel0catlevel1catlevel2catlevel3catlevel4catlevel5
count101010101010101010
unique1099156811
topdenso dtm82363 thermostat coolantautomatic transmissionautomatic transmissionSparePartPowertrain & SuspensionAutomatic Transmissionnanana
freq122104321010
\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" - } - ], + "outputs": [], "source": [ "df_eng.describe()" ] @@ -814,203 +450,9 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namesdesccatlevel0catlevel1catlevel2catlevel3catlevel4catlevel5category_automatic transmissioncategory_camshaftcategory_mountingcategory_shock absorbercategory_suspension kitcategory_tensioner pulleycategory_thermostatcategory_track control armcategory_wheel hub
0denso dtm82363 thermostat coolantthermostat coolantSparePartCooling SystemThermostatnananaFalseFalseFalseFalseFalseFalseTrueFalseFalse
1zf 1043 010 297 automatic transmissionautomatic transmissionSparePartTransmissionAutomatic TransmissionAutomatic TransmissionnanaTrueFalseFalseFalseFalseFalseFalseFalseFalse
2zf 1060 040 003 automatic transmissionautomatic transmissionSparePartTransmissionAutomatic TransmissionAutomatic TransmissionnanaTrueFalseFalseFalseFalseFalseFalseFalseFalse
3vaico v10 0131 camshaftcamshaftSparePartEngineEngine TimingCamshaftnanaFalseTrueFalseFalseFalseFalseFalseFalseFalse
4vaico v26 0302 track control armtrack control armSparePartPowertrain & SuspensionWheel SuspensionTrack Control ArmnanaFalseFalseFalseFalseFalseFalseFalseTrueFalse
\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" - } - ], + "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 },