Elliot
  • Member for 4 years, 2 months
  • Last seen more than a month ago
How does the forward method get called in this pyTorch conv net?
Accepted answer
12 votes

If you look at the Module implementation of pyTorch, you'll see that forward is a method called in the special method __call__ : class Module(object): ... def __call__(self, *input, **kwargs): ...

View answer
Which convolution should I use? Conv2d or Conv1d
Accepted answer
7 votes

When using Conv2D , the input_shape does not have to be (1,68,2). The number of samples does not have anything to do with the convolution, one sample is given to the layer at each time anyway. What ...

View answer
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
Accepted answer
5 votes

First of all, to make logical test in Python, you should not use & for a single values equalities (see this) and you should not use question marks around boolean values False and True. Now, ...

View answer
Can I arbitrarily eliminate 20% of my training data if doing so significantly improves model accuracy?
Accepted answer
4 votes

One flaw in your procedure is the use of SMOTE before splitting in train/test. This should be avoided as you may have synthetic examples in the test data which generation depends on training data and ...

View answer
NN embedding layer
4 votes

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 ...

View answer
Layer shape computation in convolutional neural net (pyTorch)
Accepted answer
3 votes

Well, with conv layers in pyTorch, you don't need to specify the input size except the number of channels/depth. However, you need to specify it for fully connected layers. So, when defining the input ...

View answer
Confused about the different aspects in Machine Learning
3 votes

1) Supervised learning is most of the time the process of learning a mapping, e.g relation, of input features x (sample) to an output y (often labels). Unsupervised learning doesn’t not use labels /...

View answer
counting number of parameters keras
Accepted answer
3 votes

In fact, you use 1D convolution. Given that the dimension of the output of embedding layer is 100, that the kernel size is 5, and that the number of filters is 128, You have 100x5x128 = 64000 weights....

View answer
How to know when to treat a problem as a classification task or a regression task?
3 votes

In effect it is ordinal regression/classification. I suggest you to go for Mean Absolute Error to take into account the missclassification that play a bigger role when far from the ground truth : $...

View answer
Text post-processing
3 votes

Identifying uninformative words is not an easy task and is domain-dependent. For example, stop words or punctuation often are discriminative a lot for sentiment analysis. If you want to test the ...

View answer
2D-Input to LSTM in Keras
Accepted answer
2 votes

Why do you define the last dimension of input_shape as $3$? Just put your desired input dimensions accordingly and it should be fine: input_shape = (img_width, img_height) Update with the full code:...

View answer
Training on a subset of data for few epochs and then proceeding to the next subset for few epochs and so on?
2 votes

Training until convergence on a subset of data and starting again on another subset is not a good idea. Gradients of loss will have high variance over your batches and so optimizing over it will not ...

View answer
Sklearn Pipelines - How to carry over PCA?
2 votes

When doing GridSearchCv, the best model is already scored. You can access it with the attribute best_score_ and get the model with best_estimator_. You do not need to re-score it in a cross validation....

View answer
Initial embeddings for unknown, padding?
2 votes

In my experience, what works well is : For padding, fill a zero vector embedding (as pixel intensity in image data padding) is the only and best solution. For words that don't have a pre-trained ...

View answer
AlexNet second layer understanding
2 votes

Okay, I got it. If anyone interested, they use 5x5 filter but with padding 2 and striding 1 so that with bias it doesn't change the 2D dimension of the output when applied on the result of max-pooling....

View answer
Smallest Possible Dataset for Text Classification using BERT
1 votes

Sorry, but there’s no rule and amount we are able to quantify. I’ve used it (multilingual) for 700 texts with a 20 multilabel classification and I had worse results than with a custom deep net (but ...

View answer
Models after word2vec outputs
1 votes

There exists multiple ways, each consisting on summarizing the embeddings of each word from a document. The most common ones when using linear models like Logistic Regression are: max of word ...

View answer
nltk measure the accuracy of the new features
1 votes

If you don’t have a classified testing set - which allows to measure a performance score, then it is useful to use part of your training data as a validation set, meaning that you test the performance ...

View answer
Getting a transition matrix from a Adjacency matrix in python
Accepted answer
1 votes

Considering a is your adjacency matrix 2D numpy array : a / a.sum(axis=0) Should do the trick (divide all elements by columns sum)

View answer
Why are bigger embedding vectors not necessarily better?
Accepted answer
1 votes

You can think about phenomenons close to the curse of dimensionality. Embedding words in a high dimension space requires more data to enforce density and significance of the representation. A good ...

View answer
Initial values of memory and previous block output in LSTM?
1 votes

Either you use a zero vector state for both (most commonly used), or you can use other approaches such as described in this article. I have personally always used zero vectors.

View answer
Accuracy reduces drastically when using TruncatedSVD with hashingvector
1 votes

Reducing from 1048576 to 100 features makes more than a 99.99% reduction of the input features dimension, knowing that SVD does not focuses on finding interesting features for classification, but ...

View answer
Naive Bayes for SA in Scikit Learn - how does it work
1 votes

In Naive Bayes, you need two values : The prior of each class : $p(c_j)$ which is the proportion of each class in the training set. The conditional probability of each term $i$ from a document ...

View answer
Is Pearson coefficient a good indicator of dependency between variables?
1 votes

If you are considering time series only, you may have an the option to run a linear regression model, considering one variable as dependent. If you can get a good R² and residual plot, with whatever ...

View answer
Text analysis - classification, parsing
1 votes

Named-Entity Recognition (NER) is one of the techniques you could look at. Different techniques exist, you could first look at pre-trained models of Spacy in Python here. Otherwise, you could train a ...

View answer
Better input for Doc2Vec
Accepted answer
1 votes

There are plenty of different approaches you can use, and none is the universal best solution. However, in general, preprocessing in twitter data, especially for Doc2Vec, follow: tokeninzing (nltk ...

View answer
high precision and recall but low cross validated accuracy
1 votes

First of all, you should use cross_val_predict to get you predictions vector, so that you followed approximately the same validation scheme to get them : Y_pred = cross_val_predict(clf, Y, cv=5) ...

View answer
Text Mining from Images
1 votes

I think you are referring to a king of image auto captioning, and why not sentence alignement ! I suggest you to go over the paper Deep Visual-Semantic Alignments for Generating Image Descriptions ...

View answer
concatenating the content of list in python
Accepted answer
1 votes

result = "" for sentence in list: result += sentence result += " " list_result = [result] Go over list comprehension if you want a more pythonic way to do it, here is the most understandable ...

View answer
Doc2Vec Input from Paragraphs
1 votes

The aim of Doc2Vec is to produce document level embeddings, thus even if words are sentence-separated if you include them in the same document it has to be considered part of the same semantic source ...

View answer