This commit is contained in:
shoney 2023-06-22 21:25:02 +00:00
parent aeddf33138
commit 1d3cb51058
8 changed files with 8778 additions and 318 deletions

View file

@ -1,5 +1,5 @@
\chapter{Training a classification model}
\chapter{Prerequisites for developing 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.
@ -82,4 +82,11 @@ The table \ref{table:l5} lists the feature description aling with the sample of
\end{table}
\section { Data imputation - on missing category levels} \label{dataimput}
\subsection{Dependency parsing for extracting nouns from features}
\section {Data imputation techniques - on missing data} \label{dataimput}
\subsection {Forward and Backward fill}
\subsection {Impute with mode}

View file

@ -2,3 +2,7 @@
\chapter{Multi level category vectorization techniques}
Vectorization of a text is a process of transforming a text into a real number representation. Scikit-learn api \parencite{sklearn_api}, provides python libraries for machine learning. Applying the ngram vectorization method transforms the text data into a real number.
\section {n-gram vectorization}
\section {Tf-iTf vectorization}

View file

@ -1,27 +1 @@
\chapter{Development environment and hardware setup}
\section {Ubuntu server 20.04 configuration}
\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.
vGPU \footnote{https://docs.nvidia.com/grid/5.0/grid-vgpu-user-guide/index.html}
\begin{lstlisting}[language=Python]
python -m pip install "elasticsearch>=6.4.0,<7.0.0"
\end{lstlisting}
\section {Docker containers - CouchDB, Elastic search, Redis}
\chapter{Neural networks for classification model}

38
doc/chapters/chapter5.tex Normal file
View file

@ -0,0 +1,38 @@
\chapter{Development environment and hardware setup}
\section {Ubuntu server 20.04 configuration}
\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.
vGPU \footnote{https://docs.nvidia.com/grid/5.0/grid-vgpu-user-guide/index.html}
\begin{lstlisting}[language=Python]
python -m pip install "elasticsearch>=6.4.0,<7.0.0"
\end{lstlisting}
\section {Docker containers - CouchDB, Elastic search, Redis}
\section {Hyper-v virtualization and networking}
\subsection{vGPU installation}
\subsection{Networking}
\subsection{SSH}
\section{Cloud computing}

View file

@ -5,7 +5,7 @@
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[nohyperlinks, printonlyused, withpage, smaller]{acronym}
\usepackage[sorting=ynt,backend=biber,style=authoryear,block=par]{biblatex}
\usepackage[sorting=nyt,backend=biber,style=authoryear,block=par]{biblatex}
\usepackage[inkscapeformat=png]{svg}
\usepackage{booktabs,multirow,array}
\usepackage{listings}
@ -51,7 +51,8 @@ chapters/introduction.tex,%
chapters/chapter1.tex,%
chapters/chapter2.tex,%
chapters/chapter3.tex,%
chapters/chapter4.tex
chapters/chapter4.tex,%
chapters/chapter5.tex
}
\begin{document}
@ -88,6 +89,7 @@ chapters/chapter4.tex
\include{chapters/chapter2}
\include{chapters/chapter3}
\include{chapters/chapter4}
\include{chapters/chapter5}
\appendix
% \include{chapters/appendix.tex}

File diff suppressed because one or more lines are too long

View file

@ -21,7 +21,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@ -34,16 +34,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Got 22329 Hits:\n"
]
}
],
"source": [
"print(\"Got %d Hits:\" % resp['hits']['total'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@ -58,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@ -68,16 +76,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df_eng.iloc[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
@ -101,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
@ -112,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@ -202,83 +201,216 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"print (df_eng.to_latex())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df_eng.isna().sum()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df_eng.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df_eng = df_eng.dropna()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df_eng.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"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>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>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>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>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>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",
"\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 NaN NaN NaN \n",
"1 automatic transmission automatic transmission NaN NaN \n",
"2 automatic transmission automatic transmission NaN NaN \n",
"3 engine timing camshaft NaN NaN \n",
"4 wheel suspension track control arm NaN NaN "
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_eng.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"df_eng.describe()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"One hot encoding "
"category = df_eng.groupby('category')"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"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>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name sdesc category \\\n",
"0 denso dtm82363 thermostat coolant thermostat coolant thermostat \n",
"\n",
" catlevel0 catlevel1 catlevel2 catlevel3 catlevel4 catlevel5 \n",
"0 sparepart cooling system thermostat NaN NaN NaN "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# df_eng = pd.get_dummies(df_eng,columns=[\"category\"])\n",
"# df_eng.head()"
"category.get_group('thermostat')"
]
},
{
@ -326,9 +458,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'transformed_vector_name' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m transformed_vector_name\u001b[39m.\u001b[39mtoarray()\n",
"\u001b[0;31mNameError\u001b[0m: name 'transformed_vector_name' is not defined"
]
}
],
"source": [
"transformed_vector_name.toarray()"
]
@ -339,6 +483,7 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"n_gram_vectorizer.vocabulary_.get('automatic')"
]
},

File diff suppressed because one or more lines are too long