Hot answers tagged

5

The make_blobs() function draws samples from a special Gaussian mixture model. A general Gaussian mixture model with $k$ clusters has a density of the form $$ p(x) = \sum_{i=1}^k \pi_i \mathcal{N}(\mu_i, \Sigma_i) $$ where $\pi_i \ge 0$ are the weights of each cluster with $\sum_{i=1}^k \pi_i = 1$, $\mu_i$ are the cluster centers, and $\Sigma_i$ are the ...


3

It looks like there are a couple of problems. First, the python code for the 1st equation does not implement it correctly. The first line of code (for the first equation in the OP) should be m = (np.sum(np.dot(X - np.mean(X), y - np.mean(y)))) / np.sum(X - np.square(np.mean(X))) However the first equation is wrong. It's not: $$m=\frac{\sum_{i=0}^{n}(x_i - \...


3

Perhaps the simplest and most generic method is inverse transform sampling. All of the distributions mentioned in OP are absolutely continuous, so it's very straightforward. Morevoer, for these distributions, the key components are all implemented in scipy already, so we only need to do algebra. Suppose $X$ is distributed according to some CDF $G$. The ...


2

I'll just consider the case with a standard Gaussian. Let $X \sim \mathcal N(0,1)$ and let $Y = \lfloor X\rfloor^+$, where this notation means to take the floor of $X$ and set it to zero if it's negative. You limited your support to $\{1,2,\dots\}$ but I'm changing the support to include zero so that the support of $Y$ is at least the same as a Poisson (as ...


2

You can use MixedLMResults.random_effects to extract the conditional means of random effects, given the data.


2

This is a gambler's fallacy, balance counts will not balanced out over trials but they will grow, here decrease because of -1 rewards. See other questions Regression to the mean vs gambler's fallacy.


2

I'm not sure there is necessarily any problem. If you are already fine-tuning a pre-trained language model (e.g. ULMFiT, BERT or something similar), then how much you gain through augmentation is a bit variable from application to application. It may have been reasonable to hope for a bit more, but it may no add that much. If you look at this paper (also an ...


2

I suspect the issue is: But when I added a feature total_time = prep_time + cook_time Your response variable is cook_time. So it is nonsense to include it as a predictor. Suppose your model is something like: $$y = x_1 + x_2 + x_3 + x_4$$ where $y$ is cook time, and $x_1$ is prep time. So let us introduce another variable to represent total time: $z = y + ...


1

It's good that you are looking at out-of-sample metrics. That said, as you see, the errors among your top 20 models do not vary a lot. I would assume the differences are not statistically significant. Thus, whether model A that performs better than model B in this holdout exercise will also perform better on new data is a toss-up. In such a situation, I ...


1

I would probably try adapting some of the NN architectures used in trajectory prediction to classification by changing the last layer, loss function, and possibly the first layer. To use CNN here, the trajectories will need to be bounded by the picture so it requires you to know a bound for the (x, y) based on the domain. Also, based on the success of RNN in ...


1

I don’t have permission to comment, so I’ll try to frame this as an answer. If you really have truncated data —data that only takes values inside (and up to) the bounds, then @Sycorax’s answer applies. However, if your data can take on wider values than your bounds in reality but are reported within the bounds — if high and low values are censored— then you’...


1

Unbalanced classes do not provide an issue in predicting probabilities as shown in detail by this post. Thank you Dave for answering to this post!


1

Logistic regression predicts $P(1)$, and we get $P(0)$ via $1-P(1)$. Remember that the GLM deals with a binomial response variable that models the probability of getting a "success", defined as $1$ in the usual way we define the binomial PMF. Therefore, a coefficient of $0.03$ means that, for every one-unit increase in the corresponding variable, ...


1

The loss of a single sample is the sum of the $J$ nodes' predictions, so for each sample, the loss is a scalar value. The expression $-\sum_j^J y_j \log p_j$ has only one nonzero term, because only one element of $y$ is nonzero. This is the correct loss for a classification problem; we can prove that this is correct by writing out the likelihood of the ...


1

I guess you should think about what your variables actually are. The tests would take something like: Condition | A | B | C | Cond. 1 |0.5|0.3|0.4| Cond. 2 |1.1|1.0|0.9| where A, B, and C are the persons and Cond. x the different conditions. Here, one step is not one replicate! You take the average step length for each person under condition 1,...,n. ...


1

Comment: Suppose $X_i$ are IID $\mathsf{Exp}(\mathrm{rate}=\lambda=1/3)\equiv \mathsf{Exp}(\mu = 3)$ and $Z = \frac{\bar X - \mu}{\sigma/\sqrt{n}}.$ Then $Z$ is not well modeled by a normal distribution unless $n$ is in the hundreds. This is because of the skewness of the exponential distribution and the consequent slowness of the convergence of the CLT. ...


1

The error in the code stands in simulating a standard Student's variate rather than a location-scale Student's variate. In the code, random_samples = np.random.standard_t(df=5,size=(sample_size,n)) should be random_samples = sigma*np.random.standard_t(df=5,size=(sample_size,n))+mu


1

a) count the votes, select the class with more votes b) count the votes weighted by the confidence (or probability) the base classifier assigns to its decision. Select the class with higher weighted vote. c) count the votes. If there is a tie (and only if there is a tie) select the class with higher weighted votes for only the classes tied as best. (I think ...


1

Since no one answered, the python package corner.py (https://corner.readthedocs.io/en/latest/) provides a helpful interface for plotting HPD regions. The documentation is good and the code simple and clean.


1

The test does not require the assumption that the data has the same shape. Without any assumptions, Mann-Whitney tests if the distribution of $X$ and $Y$ are the same: $$H_0: F_x = F_y, H_1:F_x \neq F_y. $$ In order to test equality of medians the following assumption is required. There is only a shift location between the two distributions, $F_X(x) = F_Y(x +...


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