# Tag Info

1

how can I get from scikit learn BOTH the result and the probability? You can simply run both: The results will always be consistent because there is no randomness involved at the prediction stage, only at training stage. The computations required for predicting are not intensive, so I don't think there can be any major efficiency issue running it twice. ...

0

1/ Oversampling Oversampling should be used only in the train set. Oversampling helps during training to have more data and or to help balance the classes if needed. So in your case it is best to do it only on the train set, not on the test set. GridSearchCV uses crossvalidation and will split the train set in several folds. Then the final evaluation of the ...

1

Try Optuna which is relatively faster than GridSearchCV. Also n_jobs = -1 further reduces time. Another point is to tune parameters that matter. Not all parameters will give you maximum improvement in results. Read this blog for further info: https://blog.dataiku.com/narrowing-the-search-which-hyperparameters-really-matter

1

Instead of GridSearchCV you should try Optuna. It is much faster than GridSearchCV. But apart from that, coming to your question, there is no best value for a hyperparameter per se! Period! It depends on what kind of data you have. What hyperparameter value works for one dataset might not work for another dataset. Also another point to keep in mind, there ...

0

Lets take an example. The league is Premier League and the teams playing are Chelsea, X, Y and Z (sorry I don't follow football!). So now you have data for all 4 teams for Premier League. Now comes Champions League and the teams playing are Chelsea, Y and Z (X did not get selected for some reason). Now ask yourself if you should consider data only for ...

4

Considering a team like Chelsea has played FA Cup, Champions League, Premier League and other competitions. We need to keep in mind that, other teams would also participate in the same competitions. Sports data from all teams in the competitions would help to identify Chelsea's best win against their toughest competitors that they have faced in FA Cup, ...

1

You need to include all competitions for a simple reason: you'll not have enough data if you do not. (Keep in mind that ML models generelly need large datasets while you only have a couple of matches for a given team in a given year in a given competition if it is not the national league) In their paper Learning to predict soccer results from relational data ...

1

In general there's no way to know the best values to try for a parameter. The only thing one can do is to try many possible values, but: this mathematically requires more computing time (see this question about how GridSearchCV works) there is a risk of overfitting the parameters, i.e. selecting a value which is optimal by chance on the validation set.

1

To extend my comment: As I mentioned you can set the parameter n_jobs to -1 or instead using RandomizedGridSearch (which also receives n_jobs parameter) Regarding to the parameter grid, I always select my grid so that the default values are included and from there, some values less and greater than the default (for continuous parameters) and the same logic ...

0

In your case X is not the future data. X is today data here as you try to predict tomorrow increase or decrease of value 1 or 0. So model1.predict(X) with X being today data, will give you the prediction 0 or 1. And this is it with your model

0

Elo rating system is a very useful way to model sport matches by calculating the relative skill levels of different competitors. The difference in Elo ratings between two competitors serves as a predictor of the outcome of a match. One formula for soccer Elo is: $$Rn = Ro + K × (W - We)$$ Rn is the new rating Ro is the old (pre-match) rating; K is the ...

-1

Keep the data as is and then predict since the data outside the competitions does not make any difference to the performance of the player. Try using Random forest since multiple variables like home team, away team, league, home score, and away score are involved, and since it uses ensemble techniques thus provides a more accurate result as compared to other ...

0

short answer, you cannot run your current model as described into the future. However, there is hope. When building a forecasting model, you're typically using an "autoregressive" model, which is predicting, for example, the price in the future based on the price in the past. The reason this works is you are both predicting the next value, and ...

0

You have completed the training phase. The next phase is commonly called prediction / inference. That is when already trained model predicts labels for data. Since you are using scikit-learn, you should the call .predict method. In your code, it will be model1.predict(X) where X is the numpy-like array that contains the data features. The result will be a ...

3

You are currently using the fit_transform method on both your training dataset as well as your test set. This is incorrect since you should not fit the model on your test set as (depending on the model used) this would be overfitting, and it can give issues with dataset shapes when creating new columns based on the values in the data (count vectorizer, ...

0

There are different ways to interpret your question. If you are interested in better evaluating the relative order of the features, try permutation importance . If you are interested in ordering targets, reframe it as a learning to rank problem.

1

I ran into a similar issue. Even with small tree sizes, I got a file of hundreds of megabytes. Check if you've set oob_score=True. For large training datasets this can result in a large matrix in oob_decision_function_. I kept the oob_score_, but deleted this matrix. Alternatively, you can set it to False.

2

Yes it is wrong to set shuffle=True. By shuffling the data you allow your model to learn properties of the data distribution that might appear only in the test time periods. For example, if you have a trend in the data, shuffling will 'help' you handle it. In a real-time scenario, you'll never have access to those properties of the distribution.

0

Running this now, and updating to import GridSearchCV from model_selection, the code is: import sklearn import sklearn.ensemble import sklearn.metrics from sklearn.datasets import fetch_20newsgroups # from sklearn.grid_search import GridSearchCV from sklearn.model_selection import GridSearchCV categories = ['sci.med', 'soc.religion.christian'] ...

0

Your error is that you train your model to work on the training data after a scaling operation that you defined (fit) on the training. But then to evaluate using your test data you refit the scaler on the test data, meaning you are going to apply a different scaling to the test set, than you did on the training data to train the model. You need to not refit ...

1

If your training data is large enough, the model will have enough information to deal with chance through the statistics in the data. For example maybe a great shot is successful 80% of the time, so if there are 10 instances of great shot in the data there should be around 8 of them successful. In other words, the model will use the distribution of the data ...

Top 50 recent answers are included