# Tag Info

9

At theoretical level, the embedding layer is a linear layer, there is not any difference at all. However, in practice, if you are building a deep learning software, you have to make a difference among them. This is because it does not make sense to apply an embedding layer using traditional matrix multiplication, as the input matrix is very sparse. For this ...

4

The embedding layer maps your vocabulary index input to a dense vector, so it acts as lookup layer and (if set to trainable) will be influenced on some weights only, by the words occurring in a batch of training data. Having a linear layer, it would be sequentially trained by all the data batches and would not provide a lookup functionality (each word given ...

3

If you have the vectors for your keywords, you can aggregate those to get the document vectors. The simplest(and probably one of the most effective) way is to average out your keyword vectors to form the document vector. Once you have the vectors for each of the documents, you can use similarity measures like cosine similarity to see how close your documents ...

2

It sounds like you're trying to do some sort of topic modeling. I might recommend something like Latent Semantic Analysis (LSA), Latent Dirichlet allocation (LDA), or Latent Semantic Indexing (LSI). LSA performs a matrix decomposition of the document x keyword occurrence matrix to extract salient topics. It can allow you to find the cosine similarity between ...

2

TL;DR Theoretically it is possible, but it is unlikely. 1) Uncommon subwords word1 = 'iiii' word2 = 'jjjj' word1_subwords = ['<ii', 'iii', 'iii', 'ii>'] word2_subwords = ['<jj', 'jjj', 'jjj', 'jj>'] In this example, there are basically 6 subwords: ['<ii', '<jj', 'iii', 'jjj', 'ii>', 'jj>'], but these are not common subwords in ...

2

This looks like a proper task for Doc2Vec, which is an algorithm to build paragraph embeddings. For a nice implementation with usage examples you can try out gensim. Other options can be using word2vec and using vector averaging or sum to build sentence vectors (look at this). For more approaches have a look at these two tutorials where you can see how to ...

2

There is a really good video about this topic from a PyCon in 2016. There is a pretty in-depth description on how to vectorize your sentences as well as make predictions based on those vectors. I think that would greatly help you out. That is what I used when I was learning about how to perform sentiment analysis.

1

You have several options: Drop rows that have null values. Impute the null values. Pick a dimensionality reduction algorithm that can handle null values. One example is NIPALS (Nonlinear Iterative Partial Least Squares) algorithm. That algorithm is discussed in "Multivariate Analysis of Quality: An Introduction" by Martens and Martens

1

Those vector relations are not exact. Rest assured that king - queen ≠ man - woman. What we do is finding the closest vectors to the result of king - man + woman. One of the closest vectors is queen. Nevertheless, when we try the "parallelogram approach" to verify word relations, in most cases, the closest vector is the original one. The fact that ...

1

Take for example the Euclidean distance L2, defined by: $$L_2(x,y) = \left(\sum_{i=1}^{d} (x_i-y_i)^2\right)^{1/2}$$ where $d$ is the vector dimension. You can easily add a term $\alpha \in (0,1)$ and put more weight on the first term, for example: $$L_2(x,y) = \left(\sum_{i=1}^{d} (\alpha x_i-(1-\alpha)y_i)^2\right)^{1/2}$$ That will certainly be non-...

1

This KMeans Clustering is a representative of points in the space based on 200 Features and their length. I think there is some gap in your perspective and the actual clustering. Other than "Tram", most of the other relevant features are uncommon in both the Rail Cluster. So, two different blobs are created in space. See this image, data are at ...

1

K-means clusters points (in your case represented as 745 dimensional vectors) by their similarity, that is some distance measure between points (usually the Euclidean distance). TF-IDF produces a vector from a sentence or document, where each entry (axis) represents the frequency of a word divided by the frequency of it's occurrence in all sentences or ...

1

So the question asks between the difference between an attention vector and a positional vector. To answer this question, will give some context into how the transformer differs from a sequential model, such as RNNs and LSTMs. In the case of RNNs and LSTMs, data is fed sequentially "one-by-one" into the model to predict the output (whether that is ...

1

How can I create a dual encoder though? Do I use two different neural networks? Or does output just contain one neuron that outputs similarity? You don't need to create two different neural networks (or two different encoders) for it. Whenever you have a symmetric pieces problem, like in your case, its two sentence similarity, you should encode both the ...

1

You can use total sum of boolean values. That will be fast and give a general notion of similarity. A more useful metric might be Hamming distance, the sum of matching booleans between two vectors.

1

The main idea here is: "birds of a feather flock together" That is, words that appear near each other inform the "function" of a word. More importantly, I think of the techniques you mentioned as "methods," rather than "models." The reason why is it seems possible to violate the definition of what a distributional semantic model is without appropriate data ...

1

You need to do fit_transform first then transform, Here sample example from sklearn.feature_extraction.text import CountVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import TfidfVectorizer train_set = ["president of India","machine learning is awesome", "python is awesome", "thanks for reading"] ...

1

It is perfectly valid to concatenate the vectors from two different models. It will be necessary however to experiment with the two approaches, i.e. either using individual vectors from one of the models or concatenating the vectors, before you can determine which method will produce better clustering results. It is also valid to normalize word vectors, but ...

1

While an RNN using one-hot encoded moves is possible, I would suggest that your model needs to understand chess (or similar complex games) at a deeper level to be able to associate comments to positions. I would encode the position itself (eg a layered representation like in Alpha-Zero paper), and pass those through a conv-RNN to model the temporal ...

Only top voted, non community-wiki answers of a minimum length are eligible