adatest icon indicating copy to clipboard operation
adatest copied to clipboard

Fix CVModel in TopicMembershipModel

Open lukevs opened this issue 1 year ago • 0 comments

The constructor for CVModel in TopicMembershipModel is incorrect and is causing adatest to throw errors when generating topics:

TypeError: CVModel.__init__() missing 2 required positional arguments: 'embeddings' and 'labels'

Removed the fit call because it happens internally in the __init__.

Also fixed the init to set class_weight to 1 for the passed in labels, instead of assuming labels are "pass" / "fail" (for TopicMembershipModel they are "on_topic" / "off_topic") - I think class_weight = 1 is the default behavior, but will keep for consistency

Now matches the other CVModel usage here: https://github.com/microsoft/adatest/blob/a77b5968dca69480aaf11af9a326bafab7c345a8/adatest/_topic_model.py#L93

lukevs avatar Aug 06 '23 17:08 lukevs