Credit Card Fraud Detection - Dealing with Imbalanced Datasets in Machine Learning

  Рет қаралды 38,594

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 59
@GregHogg
@GregHogg Жыл бұрын
Take my courses at mlnow.ai/!
@vishnusunil9610
@vishnusunil9610 Жыл бұрын
Stunning bro just clear cut explanation not wasting a single minute it's just a gold mine of information best video on a project explained step by step
@GregHogg
@GregHogg Жыл бұрын
Thank you for the very kind words! Glad it was helpful 😀
@prathameshmore1402
@prathameshmore1402 3 жыл бұрын
Thank you for your amazing efforts! I don't have much experience in building different models, so this video helped me a lot! Btw, I tried increasing max_depth to 6 in random forest model, and it really increased model's performance better than I expected. Thanks again!
@GregHogg
@GregHogg 3 жыл бұрын
Interesting! Yeah it's surprisingly easy to mess around with models. That's great about the max_depth! And you're very welcome :)
@somechad3682
@somechad3682 Жыл бұрын
One thing worth mentioning would be the data wrangling part. It's often a good idea to check for feature relevance and feature importance. Funny enough, the amount of transaction and the time of it were not considered as the features that had a substantial impact on the general outcome of the model to see if a transaction was fraudulent or not. This not only reduces bias in our data frame, but it can also substantially increase the computation speed of that model! (mine had a 36% boost in speed while losing only 0.01 points in F1 score, and 0.02 in precision.) Another thing would be to write a function that fits the training and validation data in each of the models automatically. It will substantially help with the cleanliness and readability of the project. I would also consider hyperparameter tuning and pipelining everything together to make it a robust project. However, great video and a great demonstration of how to check each model and measure their suitability for the problem at hand.
@kimchi6284
@kimchi6284 10 ай бұрын
please i have a poject in this topic could you pleeeease help me i don't know what to do
@petarganev4256
@petarganev4256 3 жыл бұрын
Great video on classification. Good luck with the channel!
@GregHogg
@GregHogg 3 жыл бұрын
Thanks so much Petar! I appreciate that 😊
@mellowftw
@mellowftw 3 жыл бұрын
I'll be trying this soon, thanks Greg
@GregHogg
@GregHogg 3 жыл бұрын
No problem Krish! 😊😊
@machinelearning3602
@machinelearning3602 3 жыл бұрын
Hope to see more of this kind in the coming days!!
@GregHogg
@GregHogg 3 жыл бұрын
With an account name of "Machine Learning" I would expect nothing less! 😂 And absolutely ☺️
@sivanujansivakumar5907
@sivanujansivakumar5907 3 жыл бұрын
Thanks man. I'm going to try this one. It's really helpful. 🙏😍
@GregHogg
@GregHogg 3 жыл бұрын
Enjoy! You're very welcome 😊
@motilalmeher7666
@motilalmeher7666 11 ай бұрын
After training the model on the balance population please find the model performance on the original population the imbalanced one.
@Worldwidenigespam
@Worldwidenigespam 2 ай бұрын
13:24. Why is the same data as used to fit the data used to score the model?
@aguspe532
@aguspe532 2 жыл бұрын
Great video and explanation! Thanks!
@GregHogg
@GregHogg 2 жыл бұрын
You're very welcome!
@garlicman2778
@garlicman2778 6 ай бұрын
really like your vidoe! One thing though, when you downsampling the data, shouldn't you still keep validating/testing on the ratio of data? In your case, you are basically assuming the testing data is also have a 50/50 split, which in reality will never be the case.
@mahelvson
@mahelvson 2 жыл бұрын
Great vídeo. I was just wondering if taking a slice from the original dataset to use as a test set is a more consistent way to evaluate the resampling procedure. Because in production, the model still has to deal with imbalanced data.
@Hash9211
@Hash9211 11 ай бұрын
yes I agree. I've tried slice of original data for test set and the results look completely different.
@devjain7076
@devjain7076 3 жыл бұрын
12:51 shouldn't shape of y_train be (240000, 1) since it consists of exactly one column?
@GregHogg
@GregHogg 3 жыл бұрын
(240000,) and (240000,1) are very close to the same thing. I'm not sure if they both work or not
@sushantpargaonkar5188
@sushantpargaonkar5188 5 ай бұрын
how do you balance test set when you don't have labels in real life?
@saitejatangudu6320
@saitejatangudu6320 3 жыл бұрын
Great video ❤❤ looking forward for more videos like this..
@GregHogg
@GregHogg 3 жыл бұрын
Thank you!! Absolutely 😊
@LinhGiaNguyen-x3m
@LinhGiaNguyen-x3m 2 ай бұрын
why we have to scale "Time", it is necessary ?
@juanpabloherediacastello6212
@juanpabloherediacastello6212 2 ай бұрын
why not use train test evalu split using skit learn and stratify?
@vinsanargeese4384
@vinsanargeese4384 Жыл бұрын
I just wanna know whether it gives the accuracy details only or detect whether card is fraud or not
@emrecoban3895
@emrecoban3895 Жыл бұрын
Are we not supposed to test from original data instead of balanced one.
@Mwme2000
@Mwme2000 Жыл бұрын
well i have the same question but every code i saw for this dataset with high f1 score did like him and after a lot of research i found that if you have highly imbalanced data like this it is okay to test on the under sampled data if u know anything else please share it
@amannagarkar
@amannagarkar 5 ай бұрын
In the predict function, you’re taking model as input arg but returning on shallow-nn. Is it correct? Or should it be model.predict() 28:31
@amannagarkar
@amannagarkar 5 ай бұрын
Probably that’s why the values are exactly the same at 51:51
@joxa6119
@joxa6119 9 ай бұрын
What is your opinion on doing oversampling (SMOTE) on the minority class?
@GregHogg
@GregHogg 9 ай бұрын
Definitely a solid option.
@unlucky-777
@unlucky-777 Жыл бұрын
Hey Greg, thank you for the video but I have a question. At first, we had a dataset that had 280000 rows and 30 columns but towards to end of the video, we decreased the dataset that only had 984 rows. Doesn't this make the model bad because we're trained on less data? Or the real problem was we were getting bad results at first because we had so many not_fraud data compared to fraud ones?
@SakshiSnaps
@SakshiSnaps 3 жыл бұрын
Thanks greg!! Is it okay to do projects by looking at the tutorial videos!? When is the time, we need to do it on our own
@GregHogg
@GregHogg 3 жыл бұрын
Absolutely! Go ahead. You can do it on your own when you feel like you've got the general hang of things, if that makes sense.
@ArtistrystoriesUnleashed45
@ArtistrystoriesUnleashed45 Жыл бұрын
can i try train_test_split function from sklearn to split data into train and test set?
@KeKuHauPiOx
@KeKuHauPiOx Жыл бұрын
im getting errposts on the rest train and val run for the numpy
@arsheyajain7055
@arsheyajain7055 3 жыл бұрын
Awesome 👏🥳
@GregHogg
@GregHogg 3 жыл бұрын
Thank you! 😊
@mubshali7489
@mubshali7489 3 жыл бұрын
Sweet. This is going to my github!!
@GregHogg
@GregHogg 3 жыл бұрын
I sure hope so!
@ottomaggio2725
@ottomaggio2725 2 жыл бұрын
Nice video, however, it is not completely clear to me how the undersampling relates to the overall problem. In the end, you have to provide the client (the bank) with a model capable of detecting fraud. Let's suppose we give them the model trained on the rebalanced dataset. Since frauds are unbalanced by nature, then they will end up using the model trained on a balanced dataset on a test set that is actually unbalanced. Isn't this causing issues? Isn't the prediction biased toward the fraud? Aren't we predicting way too many frauds?
@ottomaggio2725
@ottomaggio2725 2 жыл бұрын
To be more specific, I think you can try balancing the training set but you cannot balance the test set because, in the end, in the real scenario, the new data to be predicted will be always unbalanced.
@luqmanhrizal
@luqmanhrizal Жыл бұрын
its not practical to evaluate the model on the balanced the evaluation/test set since its ignore the real fraud representation. data representation is sacred.
@srijanshovit844
@srijanshovit844 2 жыл бұрын
That's amaaazzzing!!
@MatTheBene
@MatTheBene 2 жыл бұрын
Are you not leaking targets if your normalize before splitting the data?
@GregHogg
@GregHogg 2 жыл бұрын
If I am, it isn't really a big deal
@MatTheBene
@MatTheBene 2 жыл бұрын
@@GregHogg it isn't a big deal in most cases probably, but with time series data you are leaking future information that the model will not have during inference, such as changes in trend 📈 in future data points
@GregHogg
@GregHogg 2 жыл бұрын
@@MatTheBene For time series it would be more concerning yes
@allaboardthegravytrain5987
@allaboardthegravytrain5987 10 ай бұрын
thanks
@j_ckitchai
@j_ckitchai Жыл бұрын
Hi thankyou a lot from making this video I learn a lot through this, I have some question at @52:05 the line print rf.predict(x_val_b) isn't that should be rf_b.predict(x_val_b) instead ? along with Gbc later on too it should use gbc_b.predict right ??
@jeremyklauber7535
@jeremyklauber7535 7 ай бұрын
I thought that as well not entirely sure why he hadn't changed those when the neural_net_predictions function he had it under shallow_nn_b
@83Dunes
@83Dunes 5 ай бұрын
I have the same question. The inference and final choice of model may differ with that change.
@ashwanirathi948
@ashwanirathi948 3 ай бұрын
Awesome
@TernaryM01
@TernaryM01 12 күн бұрын
You're just fooling yourself (and your boss) with the final report. Run the classification report with the original dataset, not the much smaller dataset (that has been artificially made to be balanced)! To do this and then say that this demonstrates the power of balancing the dataset is foolish. Also, your neural_net_predictions function is wrong (a nasty bug you missed). At 29:50 you realized that you should change "x_train" to "x", but still overlooked that "shallow_nn" should also be changed to "model"! Because of this, neural_net_predictions always gives the prediction of shallow_nn, no matter what model you put in there, which explains the false classification report of your second neural network being EXACTLY the same as the first one (at 51:46). (It's amazing how it didn't bother you at all, at least give you a pause and suspicion that something might be wrong...)
Feature Engineering Techniques For Machine Learning in Python
47:58
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Fraud Detection: Fighting Financial Crime with Machine Learning
12:01
Fraud Analytics lecture 1
1:18:39
Bart Baesens (DataMiningApps)
Рет қаралды 19 М.
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 359 М.
Building a Fraud Detection Platform using AI and Big Data
20:43
Amazon Web Services
Рет қаралды 62 М.
How to handle imbalanced datasets in Python
11:48
Data Professor
Рет қаралды 56 М.
Fraud Detection with Graph Neural Networks
12:16
DeepFindr
Рет қаралды 29 М.
LLMs in Fraud Detection: Model Comparisons | SingleStore Webinars
1:01:32
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН