To decide which strategy is appropriate, it is important to investigate the mechanism that led to the missing values to find out whether the missing data is missing completely at random (MCAR), missing at random (MAR), or missing not at random (MNAR).
MCAR means that there is no relationship between the missingness of the data and any of the values.
A trick I have seen on Kaggle.
Step 1: replace NAN with the mean or the median. The mean, if the data is normally distributed, otherwise the median.
In my case, I have NANs in Age.
Step 2: Add a new column "NAN_Age." 1 for NAN, 0 otherwise. If there's a pattern in NAN, you help the algorithm catch it. A nice bonus is that this strategy doesn't care if it'...
Feature selection is a combinatorial optimization problem. And genetic algorithms is an optimization technique.
So there really isn't anything special, you just need to formulate your problem as an optimization one, and understand how do genetic algorithms optimize. There are enough tutorials on this.
Whether it's better or worse you already know the ...
You had a post where we discussed causality, but with ML models assumption is that data represents your problem entirely and has all the information in it. In other words every pattern that you pickup in your train data you can expect it to behave pretty similar in production, hence with this assumption what you want is to "evaluate the ...
1) Using drop_first=True is more common in statistics and often referred to as "dummy encoding" while using drop_first=False gives you "one hot-encoding" which is more common in ML. For algorithmic approaches like Random Forests it does not make a difference. Also see "Introduction to Machine Learning with Python"; Mueller, Guido; 2016:
The one-hot ...
There is no one size fits all solution.
AutoML is cool, but you wont get tailored and best-possible solutions using it.
Reason being is the fact that DS has an "art" component to it. Sure theoretically you can put everything in an huge optimization framework and find the optimum params but realistically it will take for ever. Maybe with quantum computers ...
Just stick to F1.
Yes NRI is cools but there are edgecases and its not a magic bullet. Read this paper
IF you really want to implement it you can embedd r programs in python.
Since there is already implementation in r what you could do is something like this. Just change it to use NRI.
If you expect that all zeros is a result of error in the measuring of the features (i.e. the observations should not be all 0s but they are), then I would say: Keep all the data, but increase k (from k-means) by 1. This extra one will hopefully become the class of all these wrong observations.
If you expect that all zeros is correct (i.e. these observations ...
It's a matter of data quality so it depends how the dataset was built:
Either these instances are meaningful, i.e. it makes sense that an observation would have zeros for all the features and that it would happen that often.
Or these are the result of an error, typically the complete absence of measurement for these observations.
Naturally one wants to ...
CSV is a file format and MongoDB is database.
It will save space, thats the point of database software BUT you say still different structure so every crawler is saving data in separate csv so you have to bring the data in certain normal forms to save them in ...
So how many classifiers did it improve, only 1 than dont add it.
Formally there are a couple of statistical tests.
Cochran's Q test
Is a generalisation of the McNemars test for comparing Machine Learning models.
or read this formal paper where they discuss it.
1) Feature Selection should be done by AutoML on the other hand preprocessing is normally done by the user in order to make sense fo the data.
2) AutoML takes care of the hyper-parametrization.
3) The disadvantage that I mostly find is that is extremely computationally expensive. And from what I have seen in Kaggle most of the winning solutions use manual ...
Xgboost does the feature selection for you. If you want to report how valuable certain features are for prediction, print the feature importances. Those will, however, just tell you "feature $x_1$is very important for predicting the outcome, feature $x_2$ is nearly useless for predicting the outcome, etc.".
To get risk factors with p-values, you need a ...
While I'm not sure what you mean when you say "adjust for confounders", I suppose your question is about model choice (or variable/feature selection).
Here are some thoughts on this problem:
Clearly define what you want to achieve: If you want to achieve a good prediction (so you are not up to causal modeling), choose a suitable metric to measure model ...
Confounder (lurking variable) is a variable that influences both the dependent variable and independent variable. While you are right that feature interactions are "missing" in logistic regression I am not sure how can "adjusting for confounders help"
What can definitely help is including these interactions in log.regression formula IF there are any ...
I would suggest you to:
Balance your dataset (since you are not doing an anomaly detection task, that should be fine).
Measure Precision/Recall/F1 Score and argue for them depending on your problem.
Perform K-Fold Cross Validation to compare models
Balancing your dataset
You said you have a 33:67 ratio. Why keep it like that an not just make it 50:...
K-means don't modify the underlying structure of your data. K-means will just provide the 'color' part of your graph.
To answer the question about why do you get a cuboid, it's because your underlying data are a cuboid. Not necessarily by construction, but that's what happen when you cap your data. As an exemple, look at the following code :
X1 = c(rnorm(...
A small remark to the often suggested mean/median imputation.
Applying this method would assume that your analysis is only dependent on the first moment of your variable´s distribution.
Just imagine you would impute all values of your variable with mean/median. The mean/median probably would have very low bias. But the variance would go (close to) zero. ...
scikit learn itself has some good ready to use packages for imputation. details below
MICE is not available in scikit learn as far as i know. Please check statsmodel for MICE
In R you can run a linear regression. Consider this "academic" minimal example:
df = data.frame(c(3,5,2,7,5,3), c(1,0,1,0,1,0), c(0,1,1,0,1,0))
colnames(df) = c("A", "B", "C")
Take this data as an example:
A B C
1 3 1 0
2 5 0 1
3 2 1 1
4 7 0 0
5 5 1 1
6 3 0 0
Now we can see how B and C describe A in the best way.
reg = lm(A~B+C, data=df)
F1 is just based on the confusion matrix(and taking into account class imbalance), hence different models should only focus on predicting the confusion matrix correctly and if they dont they are wrong not sensitive.
F1Score is a metric to evaluate predictors performance using the formula
F1 = 2 * (precision * recall) / (precision + recall)
recall = TP/(...
I do not agree that Bootstrapping is generally superior to using a separate test data set for model assessment.
First of all, it is important here to differentiate between model selection and assessment. In "The Elements of Statistical Learning" (1) the authors put it as following:
Model selection: estimating the performance of different models in
I am just gonna copy from Oreilly's book Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition:
With bagging, some instances may be sampled several times for any given predictor, while others may not be sampled at all. By default a BaggingClassifier samples m training instances with replacement (bootstrap=True), where m is the size ...
Very brief answer (no way to go into details here):
Aparently the two calls produce different tables containing slightly different statistics.
AIC and BIC compare nested models. So if you have some model and you add or remove some variables (for instance), you may compare AIC, BIC. There is no universal "okay" range in terms of overall figures. Even with a ...
If you're a beginner it might be useful to experiment with a database. In realistic settings, data is usually found in databases. So knowing how to interact with a database is also important for a data scientist.
cv data is tabular, while mongodb is key-value so it is also an opportunity to explore new data representation schemes.
I've never practiced this package myself, but I've read a few analyses based on SHAP, so here's what I can say:
A day_2_balance of 532 contributes to increase the predicted output. In this area, such a value of day_2_balance would let to higher predictions.
The axis scale represents the predicted output value scale. The actually predicted value is in bold ...