keras-team / autokeras

AutoML library for deep learning
http://autokeras.com/
Apache License 2.0
9.1k stars 1.4k forks source link

How to restrict the output of model to be positive #1842

Open lwq-star opened 1 year ago

lwq-star commented 1 year ago

I used the model to train data with only positive values, but the predictions yielded negative values. What can I do to make the model's predictions only positive? I don't want to directly change the negative prediction to a positive one. Should I add something to the model? reg = ak.StructuredDataRegressor(overwrite=True, metrics=[ta.metrics.RSquare(),tf.keras.metrics.RootMeanSquaredError()]) history = reg.fit(x, y, epochs=1000)