reset password
Author Message
Darren76
Posts: 39
Posted 22:42 Nov 16, 2018 |

How do you normalize a future matrix? I did not see it on any of the labs and I cannot figure it out.

so I have this future matrix  X = hearts_df[['Age', 'RestBP', 'Chol', 'RestECG', 'MaxHR', 'Oldpeak']]

how can I normalize(scale) its data?  

thanks

jpatel77
Posts: 44
Posted 22:47 Nov 16, 2018 |

You can use scikit's normalization API, namely scale() from sklearn.preprocessing package. For instance, X being the DataFrame object, scale(X) will return the scaled X.

Darren76
Posts: 39
Posted 22:52 Nov 16, 2018 |

got it  thank you

mpourhoma
Posts: 39
Posted 23:13 Nov 16, 2018 |

preprocessing.scale() in sklearn.

We learned it in previous homework.

jrmendoza21
Posts: 9
Posted 23:25 Nov 16, 2018 |

Why does tpr come out as nan, this is the error message:

C:\Programs\Anaconda3\lib\site-packages\sklearn\metrics\ranking.py:571: UndefinedMetricWarning: No positive samples in y_true, true positive value should be meaningless
  UndefinedMetricWarning)

Thank you

mpourhoma
Posts: 39
Posted 23:28 Nov 16, 2018 |

You have to change your pos sample to "Yes".

In this dataset, your positive sample is "Yes" not "1".