Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 104161

Use for data science questions related to the programming language Python. Not intended for general coding questions (which should be asked on Stack Overflow).

2 votes
Accepted

Building a summary string in a Pandas groupby (Possibly cross-tab or pivot-table question)

Say you have a dataframe of your data in this format: df = pd.DataFrame({ 'name': ['Bob', 'Bob', 'Bob', 'Tim', 'Tim', 'Tim'], 'fruit': ['Oranges', 'Apples', 'Bananas', 'Oranges', 'Apples', 'Ba …
Oliver Foster's user avatar
1 vote

Why does reducing the n_estimators in RandomForestClassifier improve accuracy?

If you are talking about testing accuracy in this case (ie you are comparing results on data you didn't train with) - it's possible that adding more estimators is overfitting on your training set and …
Oliver Foster's user avatar
0 votes
Accepted

Unable to successfully merge dataframes in pandas along labels

Try the following: new_df = pd.merge(df, df1, how='left', left_on=["Year", "Country"], right_on = ["Year", "Country"])
Oliver Foster's user avatar
1 vote

Predicting results of tennis matches based on historical data

I think your current under-performance is a data problem. The dataset in your google sheet seems like it contains far too few features that you could conceivably use to predict whether someone would w …
Oliver Foster's user avatar
1 vote
0 answers
425 views

auto_arima results summary (intercept?)

I ran auto_arima on my model from the library pmdarima and I'm trying to interpret the results printed to the console. I see two examples of similar parameters that yield different results: ARIMA(0,1, …
Oliver Foster's user avatar
2 votes
Accepted

Python sklearn model.predict() gives me different results depending on the amount of data

If XGBoostClassifier is fed the same input data over and over again it will yield the same results. There is no inherent randomness in this classifier that would different results for the same input. …
Oliver Foster's user avatar
0 votes
1 answer
109 views

Pull Random Numbers from my Data (Python)

I'm using python so any reference including python or some python libraries would be appreciated. …
Oliver Foster's user avatar
2 votes
Accepted

Same confusion matrix when changing DecisionTreeClassifier parameters

I ran your script and this is what was returned for all 3 confusion matrices: [[4 0 0] [0 3 1] [0 0 2]] This confusion matrix indicates to me that your model is working wonderfully on the testing d …
Oliver Foster's user avatar
1 vote
Accepted

Correctness of a ROC Curve

The first issue seems to be in the following block of code: # Calculating the roc curve for each class changing the pos_label value fpr_cl0, tpr_cl0, _ = roc_curve(iris_y_test, y_test_prob[:,1], pos_l …
Oliver Foster's user avatar
1 vote
Accepted

Is there a RandomForest implementation that handles categorical data without encoding in pyt...

I don't know of a python package that supports this functionality but I do suspect that it would help increase performance because it would avoid a common pitfall of using random forest on hot-encoded …
Oliver Foster's user avatar
1 vote

how Lasso regression helps to shrinks the coefficient to zero and why ridge regression dose ...

This StatQuest video does a fantastic job of explaining in simple terms why this is the case.
Oliver Foster's user avatar
2 votes
Accepted

Model to choose with Cross Validation or not?

Selecting the correct scoring metric depends on the business problem you are trying to solve. I would research the differences between f1 micro and macro and determine which scoring metric ultimately …
Oliver Foster's user avatar