r/datascience • • Mar 21 '22

Fun/Trivia Feeling starting out

Post image
2.3k Upvotes

88 comments sorted by

282

u/MeatMakingMan Mar 21 '22

This is literally me right now. I took a break from work because I can't train my model properly after 3 days of data cleaning and open reddit to see this 🤡

Pls send help

144

u/swierdo Mar 21 '22

You can never go wrong with random forest with max depth 5.

49

u/[deleted] Mar 21 '22

RFs are really robust. I always use those as a first step. I usually wind up using something else eventually but it works really well up front when trying to understand the problem.

34

u/[deleted] Mar 22 '22

They’re great for feature analysis too. Print out a few trees and checkout the gini impurity, it helps to see what’s important

12

u/swierdo Mar 22 '22

Just make sure you keep a holdout set for final evaluation when you do this. Don't want to use the same data to both select features and evaluate the final model.

→ More replies (14)

10

u/MeatMakingMan Mar 21 '22

Lol I will try and get back to you, thanks

4

u/KazeTheSpeedDemon Mar 22 '22

This is my go to for every model start. Just don't use so many estimators that your evaluation metric doesn't start tanking for the test data due to overfitting. 5 does seem to be the magic number for some reason!

→ More replies (1)
→ More replies (1)

13

u/BDudda Mar 21 '22

3 days? Man. Weeks. Or even months.

2

u/MeatMakingMan Mar 21 '22

It's just a beginner's project for an open position as a Jr Data Scientist.

I really want the job, but since I just finished building my first ever model for this challenge, I've set the goal to use this as an opportunity to learn more about Machine Learning, since I always wanted to but never got around to do so

10

u/GreatBigBagOfNope Mar 21 '22 edited Mar 21 '22

Seconding the random forest suggestion, but try starting with just a decision tree, see how good you can get the AIC/AUC with manual pruning on a super simple process. An RF is going to be a pretty good baseline for almost any classification task and it’ll… fit, at least… to a regression task. Worry about your SVMs and boosted trees and NNs and GAMs and whatever else later. Even better, try literally just doing some logistic or polynomial regressions first. You’re probably going to be pleasantly surprised.

17

u/Unsd Mar 21 '22

Yeah my capstone project, we ended up with two models. A NN and a logistic regression. And it was supposed to be something we passed off to a client. The NN did a hair better than the logistic for classification, but for simplicity sake, and because this was a project with massive potential for compounding error anyway, we stuck with the logistic. Our professor was not pleased with this choice because "all that matters is the error rate" but honestly...I still stand by that choice. If two models are juuuuust about the same, why would I choose the NN over Logistic regression? I hate overcomplicating things for no reason.

16

u/GreatBigBagOfNope Mar 21 '22 edited Mar 22 '22

Imo that was absolutely the correct decision for a problem simple enough that the two are close. There's so much value in an inherently explainable model that it can absolutely leapfrog a truly marginal difference in error rate if you're doing anything of any actual gravitas i.e. more important than marketing / content recommendation.

In the area I used to work when I was doing more modelling, if I hadn't supplied multiple options for explaining decisions made by one of my models, the business would have said "how the hell do you expect us to get away with saying the computer told us to do it" and told me to bugger off until I can get them something that can give a good reason it's flagging a case. In the end they found SHAP, a CART decision tree trained on the output, and Conditional Feature Contributions per case to be acceptable, but I definitely learned my lesson

5

u/Pikalima Mar 22 '22

You could probably have shown with a bootstrap that the standard error of your logistic regression was lower, and thus had less uncertainty than the neural network to quantify that intuition. But from the sound of it your professor would probably be having none of that.

→ More replies (2)

1

u/MeatMakingMan Mar 21 '22

I don't know much about these models, but they're for classification problems, right? I'm working with a regression problem rn (predict aparment offered price based on some categorical data and number of rooms)

I one hot encoded the categorical data and threw a linear regression at it and got some results that I'm not too satisfied with. My R2 score was around 0.3 (which is not inherently bad from what I'm reading) but it predicted a higher price to a 2 room apartment than the price avarege of 3 room apartments, so that doesn't seem good to me.

Do these models work with the problem I described? And also, how much should I try to learn about each before trying to implement them?

5

u/GreatBigBagOfNope Mar 21 '22 edited Mar 21 '22

If you're going to implement a model you should really learn about it first. At the very least a good qualitative understanding of what's going on in the guts of each one, what assumptions it's making, and what its output actually means. For example, you don't need to be able to code a GAM from scratch to be effective, but you really should know what "basis function expansion" and "penalised likelihood" mean and how they're used before calling fit_transform()

Probably worth trying a GLM tbh. See if you can work out in advance what parameters and predictors to choose before just blindly modelling, make sure your choices are based both on the theory and on what your data viz is hinting at

4

u/Unsd Mar 22 '22

No modeling advice specifically for you since I'm pretty new to the game as well, but I wouldn't doubt a model just because it prices a 2br higher than the average for a 3br. These models are based on things that humans want. If a 2br has better features than most, yeah it's gonna out price an avg 3br. This was a common example in one of my classes (except for houses), that as bedrooms increase, the variability in price increases substantially, so just plotting br against price, showed a fan shape (indicating a log transformation might be beneficial). The thought being that if you have an 800 sqft apartment with 2 bedrooms, and an 800 sqft apartment with 3 bedrooms, those bedrooms are gonna be tiny and it's gonna be cramped. Hard to say why exactly without knowing the variables, but it could be coded in one of the variables somewhere that indicates those kinds of things.

→ More replies (1)

177

u/Tastetheload Mar 21 '22

"Why did you use this particular model?"

"Well we tried all of them and this one is the best."

"But why"

"Because it gave the best results."

"But why did it give the best results."

"Because it was the best model."

45

u/Unsd Mar 21 '22

I didn't wanna be called out but here we are.

13

u/franztesting Mar 22 '22

Just make something up that sounds plausible. This is how most ML papers are written.

6

u/0598 Mar 22 '22

To be fair interpretability for neural networks is pretty hard and is a pretty active research field atm

5

u/TrueBirch Mar 22 '22

That's why when someone on my team wants to use DL, I ask them to tell me all the things they've tried first. You'd be amazed how often a first-semester stats approach can work almost as well as a neural network.

105

u/happyMLE Mar 21 '22

Cleaning data is the fun part

109

u/LittleGuyBigData Mar 21 '22

masochists make great data scientists

16

u/the_Synapps Mar 22 '22

Or just imaginative people. I like looking at outliers and coming up with outlandish reasons for why it's real data, even though it was almost always a data entry error.

3

u/TrueBirch Mar 22 '22

I do the same thing! I was looking at nursing home data and found several facilities with ten times more residents than authorized beds. I hypothesized about why these facilities were so overcrowded before realizing the data entry person accidentally added an extra zero at the end.

Similarly, I was looking at North Carolina voter data and was surprised to learn that Democrats tended to be older than Republicans. Then I checked the data notes and found out that "120" in the age column meant they did not know the person's age, and Democrats were more likely to have missing data.

6

u/KyleDrogo Mar 22 '22

Agreed. I find I have to be much more clever with data cleaning than with modeling. You have to double check everything and really explore. Learn more too

38

u/[deleted] Mar 21 '22

Responses in this thread are fascinating.

I think the disparity is in confidence of explanation. I can detail and justify every step of data cleaning, the less explanatory the model though, the less confidence I have in it.

If my explanation is limited to terms of scores and performance, I badly struggle with justification.

11

u/BretTheActuary Mar 22 '22

This is the heart of the struggle in data science. Given enough time and compute resource, you can build an amazing model, that will absolutely not be accepted by the end user because it can't be explained.

The key to success is to find the model form that is simultaneously good enough to show predictive power, and explainable to the (non-DS) end user. This is not a trivial challenge.

5

u/Alias-Angel Mar 22 '22

I find that SHAP (and other explanation models) help a lot in this kind of situation, giving individual- and model-wise explanations. SHAP has existed since I've been into ML, and honestly I can't imagine how hard it was before explanation models were popularised.

5

u/TrueBirch Mar 22 '22

The explanatory models are great, but they're still hard to explain in some contexts. I run the data science department at a corporation. Being able to fit an explanation of a model onto one MBA-proof slide remains a challenge.

74

u/Bure_ya_akili Mar 21 '22

Does a linear regression work? No? Well run it again with slightly different params

2

u/laserdicks Apr 25 '23

You gotta pump those exponents up. Those are rookie numbers.

3

u/TrueBirch Mar 22 '22

Why do you have to call me out like that?

3

u/Bure_ya_akili Mar 22 '22

XD great minds think alike

19

u/unlimited-applesauce Mar 21 '22

This is the right way to do it. Data quality > model magic

5

u/TrueBirch Mar 22 '22

Completely agree! I've built some cool models in my time, but the biggest kudos I've ever received from my boss have come from linking datasets from different parts of the company and visualizing the results.

31

u/Last_Contact Mar 21 '22

It’s usually other way around

5

u/idekl Mar 22 '22

The longer I've done data science the more this meme reverses for me. I'll whip you up any ol' sklearn model but ask me to "make exploratory inferences" and I'm procrastinating.

3

u/BDudda Mar 21 '22

Not for me.

2

u/blondedAZ Mar 21 '22

what I was gonna say lol

13

u/Sheensta Mar 21 '22

Opposite for me. Feel like without proper timeboxing, one could spend months or years just cleaning data.

35

u/pitrucha Mar 21 '22

Feels like the other way around tbf.

Cleaning the data, thinking about ways to fill nans, matching observations, bouncing back and forth emails trying to get insights into variables, finally trying to create meaningful features and documenting everything is the hard part.

After that all you have do is get is importing AutoML and writing down bounds for reasonable hyperparameters search for lightgbm and xgboost.

13

u/slowpush Mar 21 '22

Just use automl and move from where it tells you

1

u/EquivalentSelf Mar 22 '22

interesting approach. What would "move from where it tells you" involve? Not really sure how automl works exactly, but do you pick the model it chooses and then further optimize hyperparams?

4

u/[deleted] Mar 21 '22

Don’t feel discouraged! This is where you build your intuition for doing data science! Enjoy the journey and be patient with yourself. It takes time to become a data ninja 🥷.

4

u/johnnydaggers Mar 21 '22

As a more experienced ML researcher, I feel like its the other way around for me.

4

u/Rediggo Mar 21 '22

Imma be honest. I prefer this to the opposite case in which people just throw whatever to a very specific model. In my (not that long) experience, unless you are trying to build models that have to run with very raw data (probably unstructured data), leaving the model do the trick doesn't go that far.

3

u/IdeVeras Mar 21 '22

This one hit hard, damn

3

u/BDudda Mar 21 '22

Dis is de war.

3

u/MrLongJeans Mar 22 '22

How big of a leap is it from cleaning data in SQL to support an basic data model without ML and just metrics for a BI dashboard, to dumping that data into some plug and play prebuilt ML package? Like is this ML trained modelling a completely different animal, or can it piggy back on existing mature systems without needing a total redesign from the ground up?

2

u/Hari1503 Mar 22 '22

I need more memes in this subreddit. It makes me feel I'm not alone who faces this problem.

1

u/miri_gal7 Mar 22 '22

god this is scarily relatable :|

My analysis (of a survey) currently consists of breaking up different question types into different lists and compiling the resulting dataframes into further lists. I'm in deep

1

u/[deleted] Mar 22 '22

Don't worry, that is exactly how majority feel when starting out.

Also, cleaning the data is the fun part. It gives a lot of intuition and grip on the data. Building model can be done by a lot of automl algos too. You will get there, just be patient and ignore imposter syndrome.

1

u/Budget-Puppy Mar 22 '22

By the time I’m done with EDA and data cleaning I’m usually too exhausted to do any serious modeling and feature engineering

1

u/beckann11 Mar 22 '22

Just make a really shitty model to start with. Call it your "baseline" and then when something actually starts working you can show your vast improvement!

1

u/BretTheActuary Mar 22 '22

This is the way.

1

u/TheDroidNextDoor Mar 22 '22

This Is The Way Leaderboard

1. u/Mando_Bot 500718 times.

2. u/Flat-Yogurtcloset293 475777 times.

3. u/GMEshares 70936 times.

..

118940. u/BretTheActuary 2 times.


beep boop I am a bot and this action was performed ^automatically.

1

u/oniononiononionion Mar 22 '22

My base sklearn random forest just performed better than my grid searched forest. help😅

1

u/OliCodes Mar 22 '22

I clean other people's code so that it can look way cleaner

1

u/96-09kg Mar 22 '22

I have no clue what I’m doing.

1

u/ShadowWeavile Mar 21 '22

I've been having the opposite issue XD