Skip to content

Commit

Permalink
Prepare data in tensorflow model.
Browse files Browse the repository at this point in the history
  • Loading branch information
dickensc committed May 8, 2024
1 parent 0d13a63 commit 3838cd1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def internal_fit(self, data, gradients, options):

def internal_predict(self, data, options):
data = self._prepare_data(data)
predictions = self._model.predict(numpy.array(data[0]), verbose=0)
predictions = self._model.predict(data[0], verbose=0)
return predictions, {}

def internal_eval(self, data, options):
Expand All @@ -80,9 +80,9 @@ def load(self, options):

def _prepare_data(self, data):
if len(data) == 2:
return data
return [numpy.array(data[0]), numpy.array(data[1])]

return numpy.array([numpy.array(data[:, :-1]), numpy.array([[1, 0] if label == 0 else [0, 1] for label in data[:, -1]])])
return [numpy.array(data[:, :-1]), numpy.array([[1, 0] if label == 0 else [0, 1] for label in data[:, -1]])]


def calculate_metrics(y_pred, y_truth, metrics):
Expand Down

0 comments on commit 3838cd1

Please sign in to comment.