New answers tagged

0

It would be a good idea to do a semi-deep dive into logistic regression before proceeding. There are many textbooks and online resources. Logistic regression is not a classifier but is a direct probability model. Odds ratios do not provide relative likelihoods of an event. Standardizing by standard deviations is not a good idea, and "standardized&...


0

You can plot the ROC curve and the point that makes max the TPR and min the FPR. It does not requiere too much code, but I don't know if code is allowed in this channel. Another solution could be to rebalance the target distribution. There are some methods to achieve this. Take a look at SMOTE Talking about threshold = 0, as Dave and Mark has said, it would ...


0

For a highly unbalanced data set like yours, a model that always predicts 1 (as Dave was discussing) will always have high values for the metrics you're displaying. You need to focus on the negative predictions; if the interface you're using allows the selection of the metric true negative rate (also called specificity or selectivity) use that. If such an ...


1

There are several possible scenarios when one would think about calibrating probabilities: The model is misspecified or not optimally trained. That will be the case when non-linear relationships are modeled with a linear learner; or model is too rigid due to excessive regularization (model underfits); or to the contrary, the model is too flexible (overfit ...


1

Cross validate the different values for thresholds. But why not do something simpler first and just take the average of the two models?


1

It doesn't look like the model is underfitting from these graphs. The model is learning something, which can be seen from the decreasing validation loss. It is also not overfitting too badly, because the validation loss isn't deviating from the training loss too much, it's still decreasing. Underfitting would be the model not picking up on a pattern that is ...


1

Not necessarily. These parameters control how "complex" or "overfit" the model can be. If your model is too simple or too complex, misclassification will increase. There is some sweet spot of parameters for your data and problem, which you should try to find experimentally by measuring misclassification rate on a holdout set (a random ...


0

with k algorithms and n domains (datasets): 1 - You can use chi-square Table with k-1 degrees of freedom for large n (usually > 15) and k (usually > 5). 2 - In the case of smaller n and k, the chi-square approximation is imprecise and a table lookup is advised from tables of Friedman values approximated specifically for the Friedman test. Minimal ...


3

TL;DR: Use (ordinal) regression. Your problem lies somewhere between standard regression and classification, but doing standard regression is less "wrong" than doing classification. In detail: I assume that the ratings are integers, like $\{1, 2, 3, 4, 5\}$, and that one extreme (e.g. 1) means "bad" and the other (5) "excellent"....


9

To start from the end: should I just stop reading random articles? Maybe you should first take a course on statistics, data science, or machine learning, before you return to reading 'random articles'. There are many gems on the internet, but even more garbage, and without a solid foundation it may be hard to distinguish between them. Classification with ...


1

Any neural network trained on a crossentropy loss function performs categorical prediction, but the raw (trained) model output is a probability distribution (after normalization, possibly softmax). Outputting a distribution is a hallmark of probabilistic methods. The model doesn't make a prediction, per se, but you can think of the model return as prediction ...


0

Sometimes, the RGB channels in an image store independent information -- for example, the amount of green light versus the amount of red light at a certain location. Other times, we might choose to visualize some scalar field, like elevation or density, by converting scalar values into an RGB color, giving us an RGB image which is more pleasing to the eye. ...


0

Interesting problem. I would start with producing predictions of both series, the calculating correlation of the series observed with the series predicted. Another version is to then regress the observed on both predicted series (not predictors themselves), and analyze the significance of the coefficients similar to encompassing testing More advanced ...


1

If neuron had three outputs, say [-1,0,1] then it could draw three areas with linear boundaries as shown here for the first layer and solution would be (E). The second layer simply picks the south and north region as one category, and west and east regions as another. A neuron with two outputs, whether it's [0,1] or [-1,1] or any other pair of values, can ...


5

As long as we are talking only about additive neurons (i.e. all inputs to the neuron are summed together before being passed to the activation function), "unipolar" and "bipolar" can be used interchangeably. We can always transform a "unipolar" output to a "bipolar" one by multiplying by 2 and subtracting one: $$ o_{...


2

When $k = 1$, you are computing a Voronoi diagram. So the partitions between classes will be made of line segments perpendicular to the two nearest points of differing colors. The point you indicate and the green point at about $(4.9, 2.4)$ establish the blue/green boundary to the right of your indicated point. When $k = 5$, consider the cluster of one ...


5

These points are the training set. So, for $K=1$, the closest point to the lower left blue point is itself. That's why you see a weird red region nearby. Similar situation for $K=5$, the closest points are two blues, two green and one red. It seems in case of equality blue has been chosen for that specific node.


6

It looks like the graphs are plotting the training data, and classification regions. The blue point is blue because it is labeled blue in the training data. The classification regions are created by visiting each pixel, and coloring it the color of the majority vote of the $k$ nearest training points to that pixel.


1

It's only approximately true in general. The relevant theory is that of case-control sampling, from biostatistics. Scott & Wild, JRSS B, 2002 is a good reference, though they don't phrase the question in a way that looks like your question. Suppose that $$\mathrm{logit} P[Y=1|X=x] = \alpha+\beta^Tx$$ and you split at 0.5 for turning probabilities into ...


0

The TSFEL package provides this very comprehensive list of possible time series features. The source code shows how every feature is calculated in detail. You can find a comprehensive list below: * abs_energy(signal) Computes the absolute energy of the signal. * auc(signal, fs) Computes the area under the curve of the signal computed with trapezoid rule....


0

I would use a decent smooth for the characteristic time (EWMA, Sgolay, ...) on the time-series, and I would look at divergence from that smooth. If you are sampling every 5 minutes then the EWMA weight should be something like 1/12 or 1/24, or the SG window size should be around 12 or 24 units in size. I would also cyclize the time: (hour of day) --> [...


1

For matching problems, there are mainly two approaches: Single network to embed object A and object B: In natural language processing, the input would be "[CLS] SentenceA [SEP] SentenceB [SEP]". Then the neural network would measure the difference between the two sentences. In computer vision, you would need to concatenate the two images (as you ...


0

Let $\omega_1$ and $\omega_2$ be the two classes. The book mentions: In this case, (1.11) takes the form of the so-called Bayes classifier separating the two classes, subject to the assumption that the two classes of patterns were generated by sampling from two probability distributions that are correctly estimated by the Parzen windows estimators of the ...


0

Overview of what the book is saying According to the book, there are two classes of interest. Let these classes be $\omega_1$ and $\omega_2$. Also, given a feature vector $\mathbf{x}$, let: $$ y = \begin{cases} +1 & \text{if} \quad \mathbf{x} \in \omega_1 \\ -1 & \text{if} \quad \mathbf{x} \in \omega_2 \end{cases} $$ According to the book: The ...


2

Under all three hypotheses, $X_1$ and $X_2$ are two uncorrelated random variables with $E[X_1\mid H_i]$ taking on values $0,6,-4$ according as $i=1,2,3$ while $E[X_2\mid H_i]=0$ regardless of the value of $i$, and $\operatorname{var}(X_1\mid H_i) = \operatorname{var}(X_2\mid H_i)=2$ for all choices of $i$. Thus, the likelihoods of the three hypotheses are $$...


2

There are some trivial answers to consider that may serve as corner cases: If you have sufficiently few samples (if need be, 0) your model will not only be unstable but even become mathematically impossible to train. You can quite reliably construct a situation where training will be unstable by taking just enough cases to make fitting mathematically ...


0

@Cristian Garcia code can be reduced by sklearn. >>> from sklearn.metrics import precision_score >>> y_true = [0, 1, 2, 0, 1, 2] >>> y_pred = [0, 2, 1, 0, 0, 1] >>> precision_score(y_true, y_pred, average='micro')


0

Proposition 1 is sort of a tautology. They are assuming that the generative classifier is comparing a linear (more accurately affine) function with a threshold to determine the class of the observation. Consider just their continuous example. They say this (near the bottom of page 2) Note that this method is equivalent to Normal Discriminant Analysis ...


0

As whuber stated in the comments, the statement below (1.2) states $k$ is symmetric, which implies integrating over $x$ will give the same result as integrating over $x^\prime$.


0

The absolute values in the confusion matrices suggest that you've resampled the data before doing the cross-validation splits. That's generally a big no-no, as your scores aren't representative of model performance on real representative data. The first six score columns are all based on the confusion matrix, and so depend on a cutoff/threshold probability (...


1

NOTE: I'm still editing this post, need a bit more time to finish Here's a philosophical aside on the limits of few-shot learning. It is not exactly the answer to the question, but I guess it could help set the expectations straight. Part 1: Naive estimate of number of samples needed for classifier convergence. Let's say we did some dimensionality reduction ...


1

SMOTE creates artificial data-points, and in my opinion, it should always be the last option to try. The reason being "creating artificial data-points." I would follow these steps: 1 - Test some classifiers with the data you have. If the metrics are good enough for your particular goal, you are done. 2 - If the metrics are not good enough, try to ...


1

Confidence and certainty are different concepts, though strongly linked. There are two important properties for use cases such as decision making. We look for classifiers that are certain about their outcome (they rely on clues that lead to actually correct outcomes), and confident (among all possible answers, the selected answer is deemed as much more ...


1

While adjusting pos_weight does change the model, and may therefore change the association between predicted probabilities and labels, it doesn't have any direct influence on the F2 score itself. Indeed, for a multi-class and multi-label problem, it's not even clear which class or label would be a "positive." Instead, F2 score depends on the ...


1

Not a nonsense question at all! "Is it likely that if I use a nonlinear classifier for feature selection I get a different subset." Yes, that is quite possible, however, I think this is still a perfectly reasonable approach. Presumably you are doing this to cut down on time, so that you can quickly train many models on a smaller feat set. If your ...


1

Thank @djs for the great answer. Agreeing majority of it, but maybe not the last part. (Had to post another answer due to lack of reputation to comment directly.) Another interesting property: suppose that there are three categories, with the first one being correct. Cross-entropy would value the predictions $(.8, .2, 0)$ and $(.8, .1, .1)$ equally, whereas ...


0

Well it is not a devastatingly large number, especially given that you have a large dataset. Class imbalance has an effect on k-NN but if you are satisfied with your classifier's performance then you do not have to try fixing this imbalance (oversampling, undersampling, combinations...). Just make sure your classifier achieves the highest accuracy while ...


2

You are right to not be interested in probabilities that are backwards in terms of time-order and information flow. The correct terminology for the quantities you are interested in is predictive value positive and predictive value negative. But using these probabilities is discarding a great deal of information, and it is often not a good idea to have ...


1

relatively Normal and have values close to 0 (or at least I believe that). Not true. For one thing, most methods don't care about the distribution of the predictors. This confusion likely comes from assumptions about the distribution of the outcome. Second of all, this would be impossible for binary predictors. How should I proceed to engineer these ...


2

The particular paper in question, P.H. Horne et al, A Novel Radiographic Indicator of Developmental Cervical Stenosis, J Bone Joint Surg Am. (2016) 98:1206-14, seems to be an unfortunate example of what one might call "premature dichotomization." There is an established cutoff of <12 mm in saggital spinal canal diameter to classify someone as ...


0

I would like to add something to the discussion on the maximum score estimator of Manski. In case somebody is interested in computing this estimator exactly, an algorithm in R using the Mixed Integer Programming formulation of the paper Florios, K., & Skouras, S. (2008). Exact computation of max weighted score estimators. Journal of Econometrics, 146(1), ...


3

I seriously doubt the correctness of Zadrozny's conclusion. Her argument is not supported by any formal deliberations and only by one artificial example. So I can only try to interpret her logic. To answer your questions: How does the constraint that all examples in the training set are classified correctly imply that sample selection bias will not ...


0

Nearly always we assume that the data is noisy. That’s one of the points of thinking of data is statistics in terms of random variables. That’s also why we think of our models in form of $y = f(x) + \varepsilon$, where the $\varepsilon$ term stands for noise that cannot be modeled. Because you usually assume the data to be noisy, there’s no “extra steps” to ...


1

Assume you split based on minimizing the the (total) variance of the pieces. Let us sort the first feature values $$ \begin{array}{cc} f_1: & 2 & 4 & 6 & 9 \\ y:& 0 & 0 & 1 & 1 \end{array} $$ Splitting based on $f_1 > 4$ leads to the partition $\{2,4\}$ and $\{6,9\}$. The function values over these pieces are $\{0,0\}$ ...


0

Default logistic regression minimizes below function: $L(f(X, \beta), Y) = \frac{1}{N} \Sigma_i^N \left[-y_i log(f(x_i, \beta)) + (1-y_i)log(1-f(x_i, \beta))\right]$ Logistic regression with L1 penalty minimizes below function: $L(f(X, \beta), Y) = \frac{1}{N} \Sigma_i^N \left[-y_i log(f(x_i, \beta)) + (1-y_i)log(1-f(x_i, \beta))\right] + \lambda \Sigma_i^K |...


1

You could try a regression model where the par and the distance are both covariates. You're right that a regular linear regression model wouldn't work, since our response of interest is an integer, but check out generalized linear models (see glm in R). These allow for responses to be other data types. In your case, you could investigate Poisson regression, ...


1

The discrete nature of the cost plot is the result of using the convex hull to calculate the implicit cost. This is done to circumvent concave regions of the ROC curve, where the cost function $$Q(t:b,c)\overset{\Delta}{=} \left(c\pi_0(1-F_0(t)) + (1-c)\pi_1 F_1(t)\right)b$$ is not minimized for every choice of $c=\frac{c_0}{c_1}.$ Between two points at the ...


0

Differential costs and benefits of class assignments are part of the reason why measures like accuracy are considered poor ways to assess models. If you have a well-calibrated model of class probabilities, the cost issues that you raise in this two-class scenario reduce to a simple choice of a cost-based probability cutoff for class assignment. Let's say the ...


1

It sounds like you're asking two questions here: How can the decision boundary be computed / represented explicitly How can such a high-dimensional object be plotted in 2D To answer the first question for neural networks with relu activation: The first layer of a relu network (which consists of a affine transform followed by a relu activation) divides up $...


0

Does it ever make sense to use the form in equation (2) over equation (1) given that it has twice the number of parameters? As far as I see, I have not found any arguments for doing this as stated in this question. With equation (2) you get: an infinite number of solutions with almost all neural network architectures. at worst (the binary specification and ...


Top 50 recent answers are included