# Tag Info

0

You are implementing the same model but with different optimization techniques, which means the final weights will be different but if the problem is convex it should converge to the same value. SGD is dependent on initialization (as most iterative processes); The convergence might take way too long is learning rates are not set properly; Since SGD uses ...

0

Remember that LinearSVM uses the full data and solve a convex optimization problem with respect to these data points. SGDClassifier can treat the data in batches and performs a gradient descent aiming to minimize expected loss with respect to the sample distribution, assuming that the examples are iid samples of that distribution. As a working example check ...

1

No, RFE cannot guarantee that it finds the feature subset with optimal score. As with most greedy processes, the point of RFE is to reduce the computational cost (fitting a model for each of the $2^m$ feature subsets), at the cost of perhaps not finding the actual optimum (but hopefully "close enough"). See also https://stats.stackexchange.com/...

1

When used with loss="hinge" The SGDClassifier gives a LinearSVM, so they should be the same. This is matter of choosing the same hyperparameters for both. Can you check that you using the exact same parameters? As a side note (I don't know your dataset), 41.1 and 41.5 looks pretty similar, this also might be about splitting the training/testing ...

0

y_class = np.argmax(y_pred, axis = 1) here axis=1 represents check max value index column wise you are facing the error because you are passing vector (size,) y_class = np.argmax(y_pred, axis = 0) use above code to remove the error

2

You should only fit your scaler on training data. Your scaler is part of your model and fitting your scaler to some data can be considered as learning from this data. Test data is used to evaluate your model on previously unseen data, so if you fit your scaler to test data, it is not "unseen" data anymore.

0

Typically one decides between a range based normalization technique and a mean and standard deviation based normalization technique, which is known as standardization. Standardization is often preferred to some types of normalization as normalization can put too much weight on anomalous data at the extrema of the cohort. This is typically not a problem, but ...

0

The problem here is that the data train_df or test_df where ever the error is coming has a column which has a string(object) data type. you can't fit string data into a model. Only numerical data is allowed. try printing print(train_df.info()) print(test_df.info()) to see which column should be float type but is a string.

0

Based on the repo you linked in the comment section (github.com/prrao87/fine-grained-sentiment), method_class is meant to be a Class not an instance. Therefore method_class.predict is meant to be a static method not an instance method, Static method are declared without specifying a self (as they are not linked to an instance but a class) declaring your ...

1

Editing my answer - def predict(self, train_file: str, test_file: str, lower_case: bool) -> pd.DataFrame: "Train model using sklearn pipeline" train_df = self.read_data(train_file, lower_case) dev_df = self.read_data(dev_file, lower_case) learner = self.pipeline.fit(train_df['text'], train_df['truth']) # Fit the learner to ...

0

That's an example of an SVM classifier for 2-dimentional feature space. It means you've got only 2 real-valued features $x_1$ and $x_2$ and those circles and squares are objects. The painted objects are the support objects. You're right, for document classification you'd need to use more than 2 features, but it's more difficult to illustrate the concept in 3-...

1

As mentioned in the comment, if the question is when does it make sense to use coordinate descent over stochastic gradient descent, then, one advantage with coordinate descent is that, it updates only one parameter at a time. Thus, when the data has a very very large number of features, it might make sense to use Coordinate Descent over stochastic gradient ...

0

These are some ways by which you can improve your model's accuracy and reduce overfitting. Split your dataset into training, validation, and testing. Add dropout.

0

You should try FastText, which is open source library by Facebook research. https://fasttext.cc/docs/en/supervised-tutorial.html You need to create a file format needed by Fasttext algorithm. Also following suggestions for cleaning text Change the case to lower Remove hyper links Try to remove typo words Fasttext automatically converts words into n-grams. ...

1

You will have to use a mix of text processing and one hot encoding. Text column should not be treated as one-hot encoded since it will try to create one new variable for every unique sentence in the dataset, which will be a lot (and not very helpful from learning). Text vectorizer will summarize text column based on type of words/tokens that appear in it. So ...

Top 50 recent answers are included