Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python code for the comments steps in part 1 and 2 thank you!!! Remember in part 1 we bnned wins (df [] ) to a
python code for the comments steps in part 1 and 2 thank you!!!
Remember in part 1 we bnned wins (df [] ) to a categorcal varable - that was tor making the analyss a classitcation problem. Sometmes we also using binning for dimensionality reduction purposes. For instance, the feature year (df [ 'yearID' ] ) has more than 100 distinct values, so its dimensionality will be 100+. A lot of machine learning algorithms do not like high-dimensional features, so it is a common practice to bin high-dimensional features. Rule of thumb: if a categorical feature has more than 5 categories, you should consider bin it. In the block below, you are going to create your own function (assign_label) and apply it to your data ( df ). When a categorical variable is low-dimensional, we shoud create dummy variables for that. pandas provides a function called get_dummies ( ) for that. [18] 1 \# define the "assign_label" function An alternative way of binning the yearID feature is to bin it by decade, then create dummy variables based on dacades. This can be done using following codeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started