# Tag Info

## Hot answers tagged python

21

No difference. It's just a symbol. Sometimes mathematics uses symbols by convention, but there's no rule or requirement that you must use a certain symbol for a concept. In this particular case, the word lambda is reserved by the Python language, so alpha avoids overlapping with that word. As an aside, one sharp corner in sklearn is that sklearn.linear_model....

6

Here are two workable solutions for this specific density, rather than for an "arbitrary distribution" as requested by the title. 1. Since (thanks to Wolfram integrator!) \begin{align}\int_{-5}^z \{(x^2+y−11)^2&+(x+y^2−7)^2\}\,\text dx=(5 + z) (\\ &15 y^4 + 15 y^2 (-18 + z) + 10 y (-8 - 5 z + z^2)\\ & + 3 (775 + 15 z - 10 z^2 - 5 z^3 + ...

3

For the Kalman filter to replicate the results of a linear regression LR) you would have to cast your LR in state-space form: $$y_t = x_t'\beta_t + \epsilon_t$$ $$\beta_t = \beta_{t-1} + \nu_t$$ and complete the specification with $\nu_t \sim N(0,\boldsymbol{0})$ which effectively makes the $\beta_t$ fixed and a diffuse prior $\beta_0 \sim N(0,\infty\... 3 i can only answer this question in a confirmatory way. Normally, many ppl in ML have huge datasets with lots of features and rows or only a few features from kaggle with a moderate amount of rows. What is common to most ppl regardless of the datatset is, they dont derive a hypothesis or work out material. They see it as an EDA and want to confirm their ... 3 There are two approaches to reach this equation, from the mean of repeated Bernoulli trials (each trial is one observation x), or from a Gaussian approximation of a Binomial distribution (the number of successes is our only observation). Mean of repeated Bernoulli trials The$z$-score of the mean is $$z = \frac{\bar{x} - \mu}{\sqrt{\sigma^2/n}}.$$ The ... 3 Permutation importances would be suited for your goal, you can compute them as follows (example R code apended below): Fit a RF on a training dataset. Compute MSE on test observations. For each predictor variable, randomly permute the values of that variable in the test set and compute the MSE again. The difference between this MSE and the MSE computed ... 3 You should refer to the documentation for specifics. Anyway, an MDP consists of states$S$, actions$A$, transition probabilities$P$, and rewards$R$. In software implementations,$P$and$R$are often both implemented in some step function. The state and action spaces$S, A$don't have to be implemented per say, but gym does have some relevant datatypes to ... 2 The conditions you quote are for training: SVM attempts to find$w$and$b$such that $$y_i (w \cdot x_i + b) \ge 1$$ where$y_i \in \{-1, 1\}$. However, this can only succeed if the classes are linearly separable. If not, as your case suggests, you need a soft margin SVM, by introducing slack variables: $$y_i (w \cdot x_i + b) \ge 1 - \xi_i$$ For ... 2 This is sometimes referred to as estimating a "learning curve". However the code you have provided has several shortcomings, which I believe makes the results not so useful. Hyperparameter estimation is done on the same set as the final performance evaluation. This not a valid estimate for performance on unseen data. The model may be overfitted to ... 2 If you get the development version of rstanarm package, it has function called stan_surv that allows for time-varying coefficients in Bayesian survival models. Importantly, you can even model flexible baseline hazards with M and B splines. You can find out more here: https://arxiv.org/pdf/2002.09633.pdf https://github.com/stan-dev/rstanarm 2 You should split the time series instead of using a subsample as a test set, to avoid the problem you mentioned. You can find more here: https://stats.stackexchange.com/users/205266/wind. Also regarding your problem, I think the energy demand has cyclic features. I suggest you take a look at the book "Introduction to Machine Learning with Python" ... 2 First off, your understanding of period/cycle length is correct. For hourly web traffic, I would expect the strongest seasonalities for cycles of length 24h (daily seasonality) and 168h (weekly seasonality - typically weekdays and weekends differ strongly). For instance, here is traffic to CV. You have already found our multiple-seasonalities tag. Its tag ... 2 I realize I read it too quickly and mis-interpreted the question. I think the top answer already addressed the more specific question adequately, but yeah - typically the best observed point is used because there is no surety that the predicted GP maximum is higher than the best current value. It may be, but you know the high performance at the best point ... 2 Short Answer: What you're thinking about is called min-max normalization. You want the minimum value at each component to be mapped to 0, and the max to 1. Would look like this mins = tensor_list.min(dim=1, keepdim=True) maxs = tensor_list.max(dim=1, keepdim=True) normalized_data = (tensor_list - mins) / (maxs - mins) Longer Answer: What you tried is ... 2 Problem: the challenge is to know if "person X" would take item EXPENSIVE instead of CHEAP Going by the base rates you report in your question, Person X might not want to buy anything; probably this should be accounted for in the model. Have you considered aggregating the two datasets, fitting a model for a multinomial (or ordered) outcome (no buy,... 2 No, it doesn't matter. An analogy is to compare another summary statistics: the average. If you want to compute the average of the two cohorts, would you balance the data first? No, of course not. However, the standard error will larger in the group with less individuals - same with the Kaplan Meier estimate. 1 you are fitting your whole data to it, it seems the cross_val_score awaits a predefined train_test_split object. Ignore the part with 'bla' :-). Btw. it is also the kaggle data. I used it in one of my own notebooks. 1 If you want to only evaluate using cross-validation, you need to do it like this: from sklearn.linear_model import LinearRegression from sklearn.preprocessing import StandardScaler pipeline = Pipeline([ ('scaler', StandardScaler()), ('reg', LinearRegression()) ]) k = ... # define k cross_val_score(pipeline, X, y, cv=k).mean() Notes: ... 1 I agree with Patrick's comments above. I found the following articles useful which highlight that removing independent variables related to multicollinearity will improve the model output and this can be performed using a loop. https://beckmw.wordpress.com/2013/02/05/collinearity-and-stepwise-vif-selection/ Why is multicollinearity not checked in modern ... 1 Two sine waves cannot be cointegrated because a sine wave is not an integrated process; a sine wave does not have a unit root. Only integrated processes can be cointegrated. Therefore, the fact that the Dickey-Fuller test rejects a unit root in the residuals of a regression of$Y$(e.g. sine wave number 1) on$X$(e.g. sine wave number 2) does not ... 1 Solved it! One of the numpy arrays had the wrong shape, which messed up the$J_{\theta_1}(\theta_0,\theta_1)$computation. This fixed the problem: djt1 = lambda theta0,theta1: 1/m*((X_b.dot(np.array([[theta0],[theta1]]))-y)*X_b[:,1].reshape(-1,1).sum() Now the results look perfect and I can plot tangent planes for different$\theta_0$,$\theta_1$values. ... 1 Yes, the (poorly named) predict method is returning the survival function at specific time(s). I have thought of deprecating that function and suggest people use the (better named) survival_function_at_times method, which does the same thing as predict 1 We encountered the same question when building a recommender system here at Ibotta. If I recall correctly, we didn't find much a difference. It also may seem the 7th column is redundant. But in a comment, @JonnyLomond pointed out that if not provided, the tree would need to split on all 6 columns (as opposed to one if the 7th is provided). Which one is ... 1 If I understand you correctly, you are asking if the probability of "event" is different from the probability of "unknown" based on the numbers in your last table. You can think of this as n = 308,991+251,063 = 560,054 trials with outcome 1 for "event" and 0 for "unknown" (or the other way around). If the probability ... 1 To test my model should I split my data into 3: training, validation, test? If you have sufficient data to do so, then this might be reasonable. I think there may be some arguments to be made that cross validation is preferable to a one time data splitting. See Frank Harrell's Regression Modelling Strategies chapter. 5.3.4 for more if you are interested ... 1 From wiki :$AIC = 2k - 2\ln(L)$where$L$is maximum of the likelihood function and$k$is the number of parameters estimated. x = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4]] y = [[0], [49], [101], [149], [201]] res = sm.OLS(y, x).fit() # Façon 1 res.aic # gives 16.5468 # Façon 2 llf = res.llf # log-like value k = 2 aic = -2*llf + 2 * k # gives 16.5468 @... 1 I managed to create a function to calculate the CCC and Expected R Squared using this version in R - Cubic Clustering Criterion using R update. The input is a Dataframe with the features and the cluster assigned to each observation (as integer): def ccc_calculation(c_r:"Dataframe with features and cluster number in the last column"): n_c = int(... 1 One measure is variously known; I think I first encountered it as dissimilarity index, but watch out as that name is certainly generic as well as specific. The recipe is for dissimilarity between$j$and$k$over proportions in categories$i$$$(1/2) \sum_i | p_{i, j} - p_{i,k} |$$ where the prefactor$(1/2)$scales the result to lie in$[0, 1]\$. Two ...

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