Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

grid search python

from sklearn.model_selection import GridSearchCV

params = {
    'n_estimators': [5, 10, 20],
    'max_depth': [1, 5, 10],
}

grid_search = GridSearchCV(RandomForestRegressor(), param_grid=params, n_jobs=-1)
grid_search.fit(X_train, y_train)
score = np.round(grid_search.score(X_test, y_test), 3)
print(f"Best random forest classifier score: {score}")
grid_search.best_estimator_, grid_search.best_params_
Comment

PREVIOUS NEXT
Code Example
Python :: virtual env in mac 
Python :: Python program to remove duplicate characters of a given string. 
Python :: bubble sort python 
Python :: how to print numbers from specific number to infinite inpython 
Python :: how to make a bot say hello <username when a user says hello in discord with python 
Python :: how to flip a list backwards in python 
Python :: copy file in python3 
Python :: you are trying to access thru https but only allows http django 
Python :: how to set bgcolor of a widget in pyqt5 
Python :: truncate date to midnight in pandas column 
Python :: quamtum criciut python 
Python :: fizzbuzz python 
Python :: python calling dynamic function on object 
Python :: how to sort a dictionary by value in python 
Python :: how to save inputs python 
Python :: pandas dataframe creation column names 
Python :: django model query add annotation field to show duplicate count 
Python :: pandas drop extension name from list of files 
Python :: pil save image 
Python :: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256 
Python :: np.sort descending 
Python :: combining 2 dataframes pandas 
Python :: binning data dataframe, faire classe statistique dataframe 
Python :: creating a new folder in python 
Python :: python find all positions of element in list 
Python :: sort strings as numbers python 
Python :: python 3 of 4 conditions true 
Python :: list to tensor 
Python :: how to say hello with name in python 
Python :: matplotlib remove y axis label 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =