# Tag Info

1

You switched accuracy 1 and accuracy 2 in your print statements. Random states should all match. This answer on Stackoverflow might be helpful.

0

Multinational naive Bayes algorithm is a generalization of naive Bayes algorithm for case where your predicted variable is not binary, but has more categories. Why it gave you best results as compared to other algorithms? You were probably lucky. There’s no single best algorithm. For more details on why naive Bayes works, check Why do naive Bayesian ...

1

I'm with @shimao because you are comparing apples and octopi. You are converting from jpg, which is a discrete-cosine compressed transform, to a version of bitmap. How about we compress with number of clusters equal number of original distinct levels and use that as out reference instead of the DCT compressed version? If you want to be fun, you can use ...

1

The idea of your test set is to help you objectively evaluate your model's performance on unseen data. If you selected your hyperparameters with CV (on the training set) and you have only run the test set once in the end for a final evaluation, you can consider it to depict your model's performance. If you are OK with this performance, you can retrain your ...

1

The singular value decomposition, by default. The documentation says it uses scipy.linalg.lstsq, and the documentation for that says the default is Lapack's gelsd, and the documentation for that says Computes the minimum-norm solution to a linear least squares problem using the singular value decomposition of A and a divide and conquer method. That is, it ...

0

To see the forest for the trees, i.e., step back and look at the big picture, there are several types of feature selection methods that have been developed specifically for regression - all of which are performed during the regression procedure. Sometimes these approaches are called "fishing expeditions," since you are looking for good features ...

1

I am not familiar with the matlab counterpart (have not used it for some time), but I assume you are looking for the eigenvalues and eigenvectors of the covariance matrix from scikit-learn. Since you already have the pca object and have fitted it to the data R, the values you are looking for are retrievable as object attributes: For the loadings and ...

1

There are basically two problems: As Patrick said, your range of C-values doesn't make much sense; but, more importantly The default metric used by GridSearchCV, the accuracy, is not suitable for what you're trying to do: minimise the number of support vectors while keeping the optimal performance (nor is any other of the metrics provided in sklearn, btw.). ...

0

First of all, you should use encodings learnt from training data to encode test data. So, you shouldn't re-encode your test set. This answers your second and third questions I believe. How to deal with new entry of level or value of categorical variable in production test data? For this one, you have options: try to obtain a more expressive train data to ...

2

The trade-off in GMM is between the number of gaussian distribution (number of components) and the likelihood of your model. The difficulty is that there is "no truth" about the number of distributions. The more you add the higher your likelihood, the less you add the poorer your likelihood. To model that trade-off, the classic approach is to use ...

1

This is possible without discretizing your counts or changing the form of your model to something with less natural assumptions (e.g. Gaussian). The likelihood for a multinomial distribution can be expressed the way you've written it, but it can also be written differently to allow for nonnegative real counts. p(\mathbf {x} \mid C_{k}) =\frac { \left( ...

0

I finally figured it out! I should use np.dot((B-np.mean(A,axis=0)),np.transpose(pca_model.components_)) Instead of taking the mean of matrix B. Now I obtain array([[-0.55447918, -1.10164678], [-0.37055733, -1.51766277]]) which is only exactly the same as pca_model.transform(B).

0

The question is, what do you expect for a c parameter if its boundaries start at e-20: c_space = np.logspace(-20, 1, 50) param_grid = {'C': c_space} scikit learn already tells you that the c parameter can be definetely higher than 1 or 10 https://scikit-learn.org/stable/auto_examples/svm/plot_rbf_parameters.html Look at your gamma then you may be able to ...

3

Working with Cholesky factors is cheaper because determinants of triangular matrices are given by the product of the elements on the diagonal. This massively reduces the computation time for the determinants because we effectiely get to skip the computations which are needed to compute the determinant in the general case. Working with Cholesky factors also ...

0

As I understand it, performing nested CV means that you have two layers of CV, and you use each layer for one and only one thing: The outer layer, for estimating the quality of the models trained on the inner layer. The inner layer for selecting the best model (including parameters, hyperparameters and so on). One important distinction: in fact, you are ...

1

I have released a package that can help implementing nested cross validation in Python (for the moment, it only works for binary classifiers). If you want to check it out, it's here: https://github.com/JaimeArboleda/nestedcvtraining It's my first Python package, so any comments, suggestions or critics will be more than welcome!! I post it as an answer ...

0

This might depend on the solver, but the two places I see sklearn explicitly initializing coefficients, it sets them to zero: if not self.warm_start or not hasattr(self, "coef_"): coef_ = np.zeros((n_targets, n_features), dtype=X.dtype, order='F') source for the above, in ElasticNet.fit, and similar source in enet_path, ...

Top 50 recent answers are included