Skip to content

Commit

Permalink
Fix module 'keras.backend' has no attribute 'sum' (#51)
Browse files Browse the repository at this point in the history
* Fix `module 'keras.backend' has no attribute 'sum'`

Issue occurs with revent keras versions. See #49.

* Fixes #49.
  • Loading branch information
dweindl authored Jan 14, 2025
1 parent 5db51a6 commit 8c14bf2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ccompass/MOP.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import numpy as np
import pandas as pd
import tensorflow as tf
from keras import ops
from scipy import stats
from sklearn import svm
from sklearn.metrics import (
Expand Down Expand Up @@ -274,7 +275,7 @@ def create_fullprofiles(fract_marker, fract_test):


def sum1_normalization(x):
return x / (K.sum(x, axis=1, keepdims=True) + K.epsilon())
return x / (ops.sum(x, axis=1, keepdims=True) + K.epsilon())


def combine_rounds(data):
Expand Down Expand Up @@ -374,7 +375,7 @@ def build(self, hp):
# units_init = np.shape(y_train_mixed_up)[1]
model.add(
tf.keras.Input(
self.set_shapes[0],
(self.set_shapes[0],),
)
)
# model.add(tf.keras.Input(units_init,))
Expand Down Expand Up @@ -848,7 +849,7 @@ def multi_predictions(
FNN_ens = []
FNN_ens.append(FNN_best)
# FNN_ens[0] = copy.deepcopy(FNN_best)
FNN_best.build(y_train_mixed_up.shape)
# FNN_best.build(y_train_mixed_up.shape)

stringlist = []
FNN_best.summary(print_fn=lambda x: stringlist.append(x))
Expand Down

0 comments on commit 8c14bf2

Please sign in to comment.