mirror of
https://github.com/Steffo99/unimore-bda-6.git
synced 2024-11-25 01:04:19 +00:00
Normalize mean value of tensorflow models
This commit is contained in:
parent
07be21e809
commit
ade3a6bdc7
2 changed files with 2 additions and 2 deletions
|
@ -259,7 +259,7 @@ class TensorflowPolarSentimentAnalyzer(TensorflowSentimentAnalyzer):
|
|||
return model
|
||||
|
||||
def _translate_prediction(self, a: numpy.array) -> Category:
|
||||
return a[0, 0] * 5
|
||||
return (a[0, 0] + 0.5) * 5
|
||||
|
||||
|
||||
__all__ = (
|
||||
|
|
|
@ -41,7 +41,7 @@ class Review:
|
|||
return tensorflow.convert_to_tensor(self.text, dtype=tensorflow.string)
|
||||
|
||||
def to_tensor_normvalue(self) -> tensorflow.Tensor:
|
||||
return tensorflow.convert_to_tensor([self.category / 5], dtype=tensorflow.float32)
|
||||
return tensorflow.convert_to_tensor([self.category / 5 - 0.5], dtype=tensorflow.float32)
|
||||
|
||||
def to_tensor_tuple_normvalue(self) -> tuple[tensorflow.Tensor, tensorflow.Tensor]:
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue