2

If it were standardisation or normalisation or any other type of transformation that actually learns some parameters from the data and applies it to the next/incoming data, you'd have to first split into train/test, fit your transformation with training set and apply it to the test set, so that you don't learn parameters from the test set. However, yours (i....


1

In short: The example is correct but not easy to follow. You understand things correctly around nested CV but you probably did not follow the example. I do not blame you; it took me a slow read to see it is right. The example defines two K-Folds cross-validators. One called inner_cv and one called outer_cv. Notice that while both are simple 4-fold CV ...


1

What you describe, while somewhat unusual it is not unexpected if we do not optimise our XGBoost routine adequately. Your intuition though is correct: "results should not change". When we change the scale of the sample weights, the sample weights change the deviance residuals associated with each data point; i.e. the use of different sample weights' scale, ...


1

The issue is that you are calling fit_transform on both the training data and the test data. In other words, you are retraining the transformer on both the training and the test data, whereas to prevent data leakage (which is quite minor in this case, but in general is important to avoid) you would only want to fit the transformer on the train data. In this ...


1

There isn't such an initialization strategy. One simple reason is that if you select a large-enough value for $k$, there will definitely be some centroids with few samples assigned to them. One solution could be to remove centroids with a small number of samples assigned to them, after the algorithm has finished. This technique is similar to pruning in ...


1

$c$ is the intercept, often denoted $\beta_0$. It is not minimized but the loss function is minimized with $\mathbf{w}$ and $c$ as parameters.


1

You must use custom scorers via scoring option provided in cross_validate. Here is an example: from sklearn.metrics import mean_squared_error, make_scorer import numpy as np def relu(x): return np.maximum(0, x) def custom_error(y, y_pred): return mean_squared_error(relu(y), relu(y_pred)) scoring = make_scorer(custom_error, greater_is_better = False) ...


1

To add gunes' excellent answer, you may also use several scoring functions following: scoring = {'accuracy': make_scorer(accuracy_score), 'precision': make_scorer(precision_score, average = 'macro'), 'recall': make_scorer(recall_score, average = 'macro'), 'f1_macro': make_scorer(f1_score, average = 'macro', '...


1

the inverse transform of the standard deviation is wrong. Mean and standard variation have to be transformed differently. Here's a brief explanation: Transform Let's assume random variable $Y$ with mean $\mu_Y$ and variance $\sigma^2_Y.$ The "Scaler" subtracts some constant $a$ and divides the result by a factor $b.$ The transformed variable equals $Z = \...


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