strongio / foundry

MIT License
3 stars 0 forks source link

Add `.score` method to Glm models #5

Closed andywong36 closed 2 years ago

andywong36 commented 2 years ago

To increase compatibility with sklearn, we should add a .score method to the models in foundry/glm

Ideally we could do train and score a model like this

model = Glm(...)

model_matrix = get_features(get_iris_data())
targets = get_targets(get_iris_data())

model.fit(model_matrix, targets)

model.score(model_matrix, targets)

A good candidate scoring function (per @andywong36) is $R^2$ for regression models. A good candidate scoring function (per @jwdink) is logloss for classification models.

It will be difficult to have foundry identify which Glms are for regression v.s. classification. We can just default to logloss

Currently the error thrown is

AttributeError: 'Glm' object has no attribute 'score'