0

After downloading sklearn package I've add the purity metric to sklearn metric module by adding it to supervised.py and init.py in cluster folder and init.py in metrics folder just the same as other metrics that are already in module. But after installing the package python recognize all other metrics except this one.

AttributeError: 'module' object has no attribute 'purity_score

user3243416
  • 31
  • 1
  • 6

1 Answers1

0

NEVER change the code of any library you use !!

If you want to add a metric, sklearn allows you to do so using its make_scorer function.

make_scorer makes a scorer from a performance metric or loss function that you have customized.

Then you can use this scorer to perform your cross-validation. Take a look at the tutorial here.

MMF
  • 5,750
  • 3
  • 16
  • 20