Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Def error
#3
Actually, the code has been "called". It is called when when you import this module, or when you start running this program. As jefsummers said, the code in question is not inside a function. Your function get_cv_heatmap() has no body, and the code following the function's docstring is outside the function.

def get_cv_heatmap(validation):
    """
    Function to plot heat map of cross validation results
    """  
 
# This is no longer in get_cv_heatmap() because of the de-indent
# refernce: https://stackoverflow.com/questions/48791/how to plot a heat map on pivot table after grid-search
 
# Even if it was in function, where do cv_results_come from?  Did you mean validation.cv_results_?
train = pd.pivot_table(
    pd.DataFrame(validation / cv_results_),  
    values="mean_train_score",
    index="param_max_depth",
    columns="param_n_estimators",
)
Reply


Messages In This Thread
Def error - by Led_Zeppelin - Oct-20-2022, 11:44 AM
RE: Def error - by jefsummers - Oct-20-2022, 12:19 PM
RE: Def error - by deanhystad - Oct-20-2022, 04:53 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020