This commit is contained in:
shoney.arickathil 2023-09-06 00:08:48 +02:00
parent 2c287bcc74
commit e0b27235df
11 changed files with 114 additions and 60 deletions

View file

@ -378,3 +378,17 @@ year = {2016},
}
% This file was created with Citavi 6.15.2.0
@misc{Vaswani.12062017,
abstract = {The dominant sequence transduction models are based on complex recurrent or convolutional neural networks in an encoder-decoder configuration. The best performing models also connect the encoder and decoder through an attention mechanism. We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train. Our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task, improving over the existing best results, including ensembles by over 2 BLEU. On the WMT 2014 English-to-French translation task, our model establishes a new single-model state-of-the-art BLEU score of 41.8 after training for 3.5 days on eight GPUs, a small fraction of the training costs of the best models from the literature. We show that the Transformer generalizes well to other tasks by applying it successfully to English constituency parsing both with large and limited training data.},
author = {Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N. and Kaiser, Lukasz and Polosukhin, Illia},
date = {12/06/2017},
year = {2017},
title = {Attention Is All You Need},
url = {https://arxiv.org/pdf/1706.03762.pdf},
urldate = {09/05/2023},
file = {1706.03762:Attachments/1706.03762.pdf:application/pdf}
}

View file

@ -12,9 +12,9 @@ The knowledge base is a dataset with formal semantics that can contain different
\parencite[Chapter 4]{LisaEhrlinger}
\end{figure}
Figure \ref{fig:kg} illustrates the procsssing of plain text from various sources such as Wikipedia API, PDF into a graph. This abstract architecture represented by \Citeauthor{LisaEhrlinger} of a \acl{kg} portraits the asumption that a \acl{kg} is more than a \acf{kb}. \acl{kg} is a combination of \acl{kb} and \acf{qe}.
Figure \ref{fig:kg} illustrates the processing of plain text from various sources such as Wikipedia API, PDF into a graph. This abstract architecture represented by \Citeauthor{LisaEhrlinger} of a \acl{kg} portraits the assumption that a \acl{kg} is more than a \acf{kb}. \acl{kg} is a combination of \acl{kb} and \acf{qe}.
\Iac{qe} is a set of graph of possible questions that could be formed in reference to \iac{kb}. \acf{qg} for comprehensive reading is a challenging task. There are datasets available for \acs{qg}, one of it is Stanford Question Answering Dataset v1.0 (SQuAD) consisting of questions posed by crowdworkers on a set of Wikipedia articles \parencite{PranavRajpurkar.}. The limitation with such a data set is that these do not contain unanserable questions. Building a machine learning model when no answer is supported was out of scope of SQuAD objective \parencite{LupeHernandez}. Study on automatic question generation from an attention-based sequence learning model for \ac{qg} and investigate the effect of encoding sentence- vs. paragraph-level information \parencite{DuXinya.29042017}, reduces reliance on handcrafted rule based systems.
\Iac{qe} is a set of graph of possible questions that could be formed in reference to \iac{kb}. \acf{qg} for comprehensive reading is a challenging task. There are datasets available for \acs{qg}, one of it is Stanford Question Answering Dataset v1.0 (SQuAD) consisting of questions posed by crowd workers on a set of Wikipedia articles \parencite{PranavRajpurkar.}. The limitation with such a data set is that these do not contain unanswerable questions. Building a machine learning model when no answer is supported was out of scope of SQuAD objective \parencite{LupeHernandez}. Study on automatic question generation from an attention-based sequence learning model \parencite{Vaswani.12062017} for \ac{qg} and investigate the effect of encoding sentence- vs. paragraph-level information \parencite{DuXinya.29042017}, reduces reliance on handcrafted rule based systems.
\clearpage
@ -22,7 +22,9 @@ Figure \ref{fig:kg} illustrates the procsssing of plain text from various source
One of the first things required for \acf*{nlp} tasks is a creating a text corpus.
In linguistics and \acs{nlp}, corpus refers to a collection of texts. One of the objective of this paper is to web crawl and extract data related to "Motor Oil". Our intention is to fetch the unstructred text corpus specifically related to "Motor Oil" and to create a graph-based knowledge.
In linguistics and \acs{nlp}, corpus refers to a collection of texts. An intriguing application of knowledge graphs within the e-commerce industry involves the creation of a comprehensive information network concerning products. Such a knowledge graph can serve as the basis for chatbots to provide answers to user queries. Converting unstructured text corpus into a directed acyclic graph. Knowledge base serve as a foundation for chatbot applications to traverse through the graph
structure, locate relevant leafs nodes, and formulate human-readable response.
Wikipedia\footnote{https://www.wikipedia.org/} is primarily an encyclopedia with the additional benefit of heavy linking between articles and without the size constraints of paper articles \parencite{TorstenZesch}. Wikipedia API \footnote{https://pypi.org/project/Wikipedia-API/}
@ -47,11 +49,11 @@ Traversing further right of the dependency tree we can extract the \acsp{pobj}.
\section{Knowledge graph with Networkx}
The directed graphs created with Networkx \parencite{hagberg2008exploring} is suitable for representing depedency parsing of a sentence mentioned in section \ref{dependencyparsing}. A knowledge base are represented as triples of \acf{SRO}. In which the subject and object are nodes or entities of a graph and relation are directed edges or links between the nodes.
The directed graphs created with Networkx \parencite{hagberg2008exploring} is suitable for representing dependency parsing of a sentence mentioned in section \ref{dependencyparsing}. A knowledge base are represented as triples of \acf{SRO}. In which the subject and object are nodes are entities of a graph and relation are directed edges or links between the nodes.
\subsection{What to use as nodes n(x) and edges e(y)?}
In table \ref{table:1}, distigution of triples by \acs{POS} tags is depicted.
In table \ref{table:1}, distingution of triples by \acs{POS} tags is depicted.
\begin{table}[h!]
\begin{center}
\begin{tabular}{>{$}l<{$} l}

View file

@ -14,54 +14,45 @@ Data collection is simply a process of fetching the data from the data source. H
In this project, author choose to create a classification model with only one feature that is the name of the product. However, author identifies the potential features to classify the target of n levels of category. These features have been identified based on the understanding of domain of the product. For products with many details will have many more features to be taken into consideration. In such case, selection based on common understanding of the nature of the product may not be sufficient. Hence, Scikit learn \parencite{sklearn_api} provides methods to define feature appropriately.
\section {Fetch existing product taxonomy using Elasticsearch}
Elastic search \footnote{https://www.elastic.co/} is a fast and scalable search and analytics engine. It can build a powerful AI and machine learning enabled search experience. In this paper, author fetches labeled dataset of products to serve as the training data for the machine learning model.
For this project, python client elasticsearch 6.8.2 is installed as the client needs to be compatible with Elastic search version being used. The official Python client provides mapping with Elasticsearch REST APIs.
\section {Feature selection methods} \label{sec:feature-selection}
\begin{lstlisting}[language=Python]
resp=self.es.search("english-name-category",{"_source":["id","name","category"],
'from':_from,
'size' :_size ,
"query": {"match_all": {}}})
\end{lstlisting}
A feature represents a dataset fine-tuned to serve as a training data for machine learning model. Choosing obvious set of features could get a decent performance on classification task. However, carefully constructed relevant set of features could impact the learning ability and have a significant gain in performance. The feature selection API from Scikit learn \parencite{sklearn_api} also refers to it as dimensionality reduction.
The above code fetches indexed product name and its lowest hierarchy level category.
\begin{table}[h]
\caption{Index: english-name-category statistics}
\parencite{BirdKleinLoper09} describes some approaches for feature selection as following:
\begin{itemize}
\item Kitchen sink
All the features are initially included later each are checked to determine whether they are actually helpful.
\item Error analysis
The data corpus is split into development-set and test-set. Development-set is subdivided into training set and dev-test set. Training set is used to train the model, dev-test set is employed for error analysis. The individual error cases are examined for wrongly predicted labels.
\begin{figure}[H]
\centering
\label{table:enc}
\begin{tabular}{ll}
\toprule
\includegraphics[scale=0.5]{corpus-org.png}
\caption{Corpus organization for supervised classification \parencite{BirdKleinLoper09}}
\label{fig:corpus-supervised-classification}
\end{figure}
Samples total&22160 \\
Dimensionality&2 \\
Features&name \\
Label&category \\
\end{itemize}
\bottomrule
\end{tabular}
\end{table}
Table \ref{table:enc} highlights the total number of products and category, which field is considered as feature and target.
\section {Feature selection and dataset sources} \label{sec:feature-selection}
A feature represents a dataset fine-tuned to serve as a training data for machine learning model. Choosing obvious set of features could get a decent performance on classification task. However, carefully constructed relevant set of features could impact the learning ability and again a significant gain in performance. The feature selection API from Scikit learn \parencite{sklearn_api} also refers to it as dimensionality reduction. A common approach for feature selection is ``kitchen sink'' in which all the features are initially included later each are checked to determine whether they are actually helptfull \parencite{BirdKleinLoper09}.
In table \ref{table:enc} the dimensionality is only two. Here, the feature is ``Product name'' and label is ``Category''. Selecting features from higher number of dimensionality is a challenge. Appropriate features are factors to improve the classification models' accuracy scores.\\
Various methods for feature selection with Scikit Learn API are:-
\begin{enumerate}
Methods for feature selection with Scikit Learn API are:-
\begin{itemize}
\item Removing features with low variance
\item Univariate feature selection
\item Recursive feature elimination
\end{enumerate}
\end{itemize}
\section{Potential features}
\section{Obvious feature selection}
In this paper, the datasets used are of an ecommerce business specializing in automotive industry domain. Secondary dataset used is from the TecDoc catalogue by TecAlliance \footnote{https://www.tecalliance.net/}.
Refer table \ref{table:feature_decription} to view the potential features for an ecommerce domain. In this paper, five levels of categories are taken into consideration. The number of category levels differ for each product. Consider an example of category tree with three levels.
Table \ref{table:feature_decription} lists the obvious features for an ecommerce domain. In this paper, five levels of categories are taken into consideration. The number of category levels differ for each product. Consider an example of category tree with three levels.
\begin{quote}
\centering
@ -96,9 +87,39 @@ In this example, the lowest level of category is ``thermostat'' as level 4 and l
\end{table}
\section {Fetch existing product taxonomy (Corpus) using Elasticsearch}
Elastic search \footnote{https://www.elastic.co/} is a fast and scalable search and analytics engine. It can build a powerful AI and machine learning enabled search experience. In this paper, author fetches labeled dataset of products to serve as the training data for the machine learning model.
For this project, python client elasticsearch 6.8.2 is installed as the client needs to be compatible with Elastic search version being used. The official Python client provides mapping with Elasticsearch REST APIs.
\begin{lstlisting}[language=Python]
resp=self.es.search("english-name-category",{"_source":["id","name","category"],
'from':_from,
'size' :_size ,
"query": {"match_all": {}}})
\end{lstlisting}
The above code fetches indexed product name and its lowest hierarchy level category.
\begin{table}[h]
\caption{Index: english-name-category statistics}
\centering
\label{table:enc}
\begin{tabular}{ll}
\toprule
Samples total&22160 \\
Dimensionality&2 \\
Features&name \\
Label&category \\
\bottomrule
\end{tabular}
\end{table}
Table \ref{table:enc} highlights the total number of products and category and name of fields considered as feature and label.
\section{Summary}
In this chapter, search analytic engine named Elastic search is introduced. The author as a prototype of classification model choose to include only two-dimensionality. One is the feature (product name) and other is the target to be predicted (category.)
In this chapter, search analytic engine named Elastic search is introduced. The author as a prototype of classification model choose to include only two-dimensionality. One is the feature (product name) and other is the label to be predicted (category.)
Table \ref{table:feature_decription} list the features for determining the product taxonomy. These features are listed based on general knowledge and understanding. However, method for feature selection mentioned by Scikit learn API \parencite{sklearn_api} can be used to determine the features.
Table \ref{table:feature_decription} list the features for determining the product taxonomy. These features are listed based on general knowledge and understanding. However, productive method for refining the feature such as error analysis can be utilized for feature selection. Scikit learn API \parencite{sklearn_api} also provides some functions for feature selection.

View file

@ -74,6 +74,23 @@ Another option is to replace the German characters to equivalent English soundin
\end{tabular}
\end{table}
\section{Avoided normalization processes}
In this project, some commonly practiced normalization process are being avoided. Which once and why are described below.
\begin{itemize}
\item Stemming
Stemming is a process of striping off any affixes. \acl{nlp} tools such as NLTK provide stemmers. The Porter and Lancaster
stemmers follow their own rules for stripping affixes \parencite{BirdKleinLoper09}. Author required not to deviate from the original vocabulary of features.
\item Lemmatization
Lemmatization remove the affixes if the word is in the used libraries' dictionary. The vocabulary for corpora and any third party library such as WordNet cannot be synced.
\end{itemize}
\section{Summary}
Before extracting the features (refer chapter \ref{sec:feature-extraction}) it is important to normalize and standardize the data set. If the text normalization step is skipped then while creating the numerical representation of the text the data will be inconsistent. For example, same text with proper case (Car) or lower case (car) will have two representation even though the semantic meaning is the same.

View file

@ -2,15 +2,11 @@
Transforming text or image data into numerical representation usable for machine learning is called feature extraction. Raw sequence of data cannot be fed directly into a machine learning algorithm as they expect data in numerical vector and in fixed size. Whereas raw text document are of variable lengths.
\section{Tokenization}
\section{Count Tokenization}
Tokenization is splitting the text in sequential words which can be embedded in a vector space.
For example, the normalized product name ``abc joint kit drive shaft'' can be tokenized into ``abc'',``joint'',``kit'',``drive'',``shaft''.
\section{Counting}
Number of occurrence of each token in a document is called counting in terms of numerical feature extraction.
\section{Count Vectorization or One-Hot encoding} \label{ch_countvector}
@ -78,6 +74,9 @@ Pickle \footnote{https://docs.python.org/3/library/pickle.html} module creates a
pickle.dump(self.vectorizer, open("vector.pickel", "wb"))
\end{lstlisting}
The memory use will grow as the vocabulary in the text corpus grows. Pickling and un-pickling of vectorizer will slow for large vocabulary.
This issue can be tackled by hashing the features.
\section{Summary}
Feature extraction is a process of transforming the normalized text into numerical representation for machine learning. Tokenization of text and Counting are terms to split the text in sequence of words and there occurrence.

View file

@ -186,7 +186,6 @@ The back propagation learning procedure proposed in \parencite{Rumelhart.1986}
\item These gradients can be accessed to update the model parameters through an optimization algorithm like \acf{SGD} . Iteratively trained neural network's gradient-based optimizers drive the cost function($LogSoftmax$) to a very low value.
\end{enumerate}
\clearpage
\section{Experimentation: Variation in the training parameters.}
@ -307,7 +306,7 @@ The steps involved in training a model with \acs{CLR} are as follows :
The result of training process the model with $base\_lr =1 \times 10^{-11}$ and $max\_lr=0.9$.\\
In figure \ref{fig:Loss value} notice that at 32 \% of training completion with learning rate $\approx$ 0.2 the loss started to explode. Hence, we conclude that the $max\_lr < 0.2$
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[scale=0.6]{loss_nan.png}
\caption{Result: Loss value returning nan}
@ -317,9 +316,9 @@ The steps involved in training a model with \acs{CLR} are as follows :
\item In the next experiment, we set the $max\_lr = 0.2$. \\
The classification model successfully completed the training and was able to predict the category.
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[scale=0.9]{loss_lr_02.png}
\includegraphics[scale=0.8]{loss_lr_02.png}
\caption{Loss vs Learning rate; where $max\_lr = 0.2$}
\label{fig:Loss value at 0.2}
\end{figure}
@ -328,7 +327,7 @@ The steps involved in training a model with \acs{CLR} are as follows :
\item In the next experiment, we set the $max\_lr = 0.04$. \\
Notice in figure \ref{fig:Loss value at 0.04}, there is a plateau until $\epsilon = 0.010$. After which there is a descent until $\epsilon = 0.015$
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[scale=0.9]{loss_004.png}
\caption{Loss vs Learning rate; where $max\_lr = 0.04$}
@ -337,16 +336,16 @@ The steps involved in training a model with \acs{CLR} are as follows :
\item In the next experiment, we set the $max\_lr = 0.015$. \\
Notice in figure \ref{fig:Loss value at 0.015}, the loss had not neared zero and the model fails to predict the classification.
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[scale=0.9]{loss_0015.png}
\caption{Loss vs Learning rate; where $max\_lr = 0.015$}
\label{fig:Loss value at 0.015}
\end{figure}
\item From the earlier mentioned experimentation with $max\_lr$, the loss classification model is nearing zero by the end the training when $max\_lr > 0.015$
\item From the earlier mentioned experimentation with $max\_lr$, the loss in classification model is nearing zero by the end the training when $max\_lr > 0.015$
Figure \ref{fig:Loss value at 0.02} illustrates the loss reaching near zero when $max\_lr = 0.02$. The figure \ref{fig:Loss value at 0.02}, there is a plateau until the $ \epsilon = 0.0075$. Indicating that the model did not learn until the learning rate $ \epsilon = 0.0075$.
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[scale=0.9]{loss_002.png}
\caption{Loss vs Learning rate; where $max\_lr = 0.02$}
@ -355,7 +354,7 @@ The steps involved in training a model with \acs{CLR} are as follows :
\item Updating the $base_lr=0.0075$ and $max_lr=0.02$, resulted a steady slop in the loss vs learning rate.
Figure \ref{fig:Loss value at 0.0075} illustrates the loss reaching near zero when $max\_lr = 0.02$ and $base_lr=0.0075$. The steady decent indicates the learning rate range is optimal.
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[scale=0.9]{loss_0075_002.png}
\caption{Loss vs Learning rate; where $base\_lr = 0.0075$ and $max\_lr = 0.02$ }
@ -371,7 +370,6 @@ The steps involved in training a model with \acs{CLR} are as follows :
How triangular learning rate works?
\begin{enumerate}
\item \textbf{Initialize}: The step size $ t $, minimum bound or base learning rate $ base\_lr$ and maximum bound or the max learning rate $max\_lr$ are initialized. These hyperparameters are tuned based on the architecture of the model. In this experiment, the values set are $ base\_lr=0.0075 ; max\_lr=0.02; t=10000$.
\item \textbf{Up phase}: During training, the learning rate is linearly increased from $ base\_lr$ to $max\_lr$ over a certain number of step size $ t $.

BIN
doc/images/corpus-org.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,4 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://www.nltk.org/book/ch06.html
HostUrl=https://www.nltk.org/images/corpus-org.png

View file

@ -82,7 +82,6 @@
{\setunit*{\addspace}%
\printtext[urldate]{\printurldate}}}
\DeclareFieldFormat{url}{Available at\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{\\Accessed on\addcolon\space#1}

View file

@ -11,11 +11,11 @@ Master Thesis \\
Electronic commerce started in early 1990's in which the business transactions are conducted through computer networks. The ease of buying a product online has reduced physical work and time required for decision-making by compare the product features. A wide range of products are sold online. One of the challenge is to well define a products' taxonomy. A product taxonomy is a hierarchical structure to organize the products in an E-commerce platform in such a way that customers can find the product in the fewest possible clicks.
Product taxonomy for the same product may differ based on the supplier and manufacturer (sources). Hence, product taxonomy details cannot be imported directly from the sources into the E-commerce platform. Product details cannot be live until its taxonomy is not well-defined, this delays the time of product availability for customers. \\
Product taxonomy for the same product may differ based on the supplier and manufacturer (sources). Hence, product taxonomy details cannot be imported directly from the sources into the E-commerce platform. Product details cannot be live until its taxonomy is not well-defined, this delays the time of product availability for customers.
In this thesis the author developed a machine learning classification model to predict the product taxonomy based on the features of the product. This is achieved with machine learning model. Experimenting and analyzing by varying model's parameters facilitated to determine models performance. \\
In this thesis the author developed a machine learning classification model to predict the product taxonomy based on the features of the product. This is achieved with machine learning model. Experimenting and analyzing by varying model's parameters facilitated to determine models performance.
Initially, from the existing product taxonomy the features such as name and description were extracted. These extracted features were passed through process of text normalization, imputation of missing text to standardize it before converting it into One-Hot encoded format. These features and its lowest hierarchical level of category were processed by \acf*{RNN} machine learning model to learn the patterns of feature and classify it with the concept of probability distribution.\\
Initially, from the existing product taxonomy the features such as name and description were extracted. These extracted features were passed through process of text normalization, imputation of missing text to standardize it before converting it into One-Hot encoded format. These features and its lowest hierarchical level of category were processed by \acf*{RNN} machine learning model to learn the patterns of feature and classify it with the concept of probability distribution.
The result of predicting the lowest hierarchical level of product category based only on product name formed a foundation to create a machine learning model to predict the complete product taxonomy. As the level of category to be predicted increases the model's weight and product features need to be adjusted.

View file

@ -1,12 +1,12 @@
\begin{titlepage}
\vspace*{5\baselineskip}
\vspace*{3\baselineskip}
\begin{flushright}
\includegraphics[scale=0.3]{SRH_Hochschule_Heidelberg_logo.svg.png}
\end{flushright}
\vspace*{5\baselineskip}
\vspace*{3\baselineskip}
\centering