googledatalab / pydatalab

Google Datalab Library
Apache License 2.0
195 stars 81 forks source link

Custom loss(score) function #603

Open ZedYeung opened 6 years ago

ZedYeung commented 6 years ago

I noticed there are regularization args l1 and l2. But I cannot find the args about customizing loss function.

In evaluation,

%%ml evaluate regression

there are multiple metrics.

Why not at least add some loss function choices like this?

It would be excellent if custom loss(score) function just as flexible as sklearn http://scikit-learn.org/stable/modules/model_evaluation.html

qimingj commented 6 years ago

Makes sense. Right now for regression loss is MSE, and classification I think is cross entropy loss. I'll see what I can do.

ZedYeung commented 6 years ago

May be just use

tf.contrib.learn.DNNEstimator
tf.contrib.learn.LinearEstimator

rather than

 tf.contrib.learn.DNNRegressor
tf.contrib.learn.LinearRegressor
 tf.contrib.learn.DNNClassifier
tf.contrib.learn.LinearClassifier

And add the according args in tf.contrib.learn.head like loss_fn and weight_column_name, etc