Hello,
I am trying to pdp_isolate the ‘Sex’ feature in the Titanic competition, but I get an error if I try running the same code as shown in the lesson. Contrary to the original lesson’s code, pdp_isolate requires a new argument in addition to feat: features (the features of the model). So I did:
features = [feat for feat in df_raw.columns]
['PassengerId',
'Survived',
'Pclass',
'Name',
'Sex',
'Age',
'SibSp',
'Parch',
'Ticket',
'Fare',
'Cabin',
'Embarked']
and then:
def plot_pdp(feat, clusters=None, feat_name=None):
feat_name = feat_name or feat
p = pdp.pdp_isolate(m, df_raw, features, feat)
return plot_pdp(p, feat_name, plot_lines=True, cluster=clusters is not None, n_cluster_centers=clusters)
plot_pdp('Sex')
But I get this error:
TypeError: can't multiply sequence by non-int of type 'float'
Did anyone have any trouble using this function? What does this TypeError mean?