Code Monkey home page Code Monkey logo

Comments (7)

mikkokotila avatar mikkokotila commented on July 17, 2024 1

Could you install from master and see what happens (at least you should get a different error message then):

pip install git+https://github.com/autonomio/talos.git

Also can you post your model code for reference.

from talos.

matthewcarbone avatar matthewcarbone commented on July 17, 2024 1

@Jakedismo just to clarify, this is a known issue and is addressed in the version of Talos that @mikkokotila posted. Basically there was a catch-all statement that spit out the error message you're seeing regardless of the error.

If what you posted above is the model function you're trying to import to Talos, it won't work because the arguments are not in the right format.

Also, in a more recent version of Talos (on the Master branch) you can manually specify the validation and training sets independently if you want.

Does this help at all?

from talos.

Jakedismo avatar Jakedismo commented on July 17, 2024
def DAE_CF(x_train, y_train, x_val, y_val, params):
    #model = Model()
    user_input = Input((train_x.shape[1],), name='user_input')
    #model.add(user_input)
    h_user = Dropout(1)(user_input)
    #model.add(h_user)
    #h_item = Embedding(input_dim=I, output_dim=K, input_length=1, W_regularizer=l2(l))(item_input)
    encoded = Dense(50, W_regularizer=l2(params['lr']), b_regularizer=l2(params['lr']))(h_user)
    #model.add(encoded)
    
    item_input = Input((1,), dtype='int32', name='item_input')
    #model.add(item_input)
    h_item = Embedding(input_dim=len(y_train), output_dim=50, input_length=1, W_regularizer=l2(params['lr']))(item_input)
    #model.add(h_item)
    decoded = Flatten()(h_item)
    #model.add(decoded)

    h = merge([encoded, decoded], mode='sum')
    if hidden_activation:
        h = Activation(params['hidden_activation'])(h)
    y = Dense(train_x.shape[1], activation=params['output_activation'])(h)
    #model.add(y)
    model = Model(input=[user_input, item_input], output=y) 
    #model.add(autoencoder)
    
    encoder = Model(user_input, encoded)
    encoded_input = Input((50,), name='encoded_input')
    decoder_layer = autoencoder.layers[-1]
    decoder = Model(encoded_input, decoder_layer(encoded_input))

    model.compile(loss=params['loss'], optimizer=params['optimizer'], metrics=[metrics.rmse, 'accuracy'])
    history = autoencoder.fit(x=x_train, y=y_train,
                       batch_size=batch_size, epochs=n_epochs, verbose=1,
                       validation_data=[x_val, y_val])
    return history, model

from talos.

timvhamme avatar timvhamme commented on July 17, 2024

Same problem here. I have not a Sequential model, but a Model(), a Model has not got a predict_classes(). I;m using Keras 2.2.0

File "/usr/local/lib/python3.5/dist-packages/talos/scan/Scan.py", line 142, in init
self._null = self.runtime()
File "/usr/local/lib/python3.5/dist-packages/talos/scan/Scan.py", line 147, in runtime
self = scan_run(self)
File "/usr/local/lib/python3.5/dist-packages/talos/scan/scan_run.py", line 29, in scan_run
self = rounds_run(self)
File "/usr/local/lib/python3.5/dist-packages/talos/scan/scan_run.py", line 61, in rounds_run
self._val_score = get_score(self)
File "/usr/local/lib/python3.5/dist-packages/talos/metrics/score_model.py", line 17, in get_score
y_pred = self.keras_model.predict_classes(self.x_val)
AttributeError: 'Model' object has no attribute 'predict_classes'

from talos.

PTerrier avatar PTerrier commented on July 17, 2024

@timvhamme, I found a solution for this problem: modify the score_model.py file as follows

from .performance import Performance

def get_score(self):

#y_pred = self.keras_model.predict_classes(self.x_val)  # not supported by Model()
y_prob = self.keras_model.predict(self.x_val)    # supported by Model()
y_pred = y_prob.argmax(axis=-1)  # return the class
return Performance(y_pred, self.y_val, self.shape, self.y_max).result

from talos.

mikkokotila avatar mikkokotila commented on July 17, 2024

This is related with #39, #42 and #64. It looks like in #64 we've just agreed to add this fix as a parameter into Talos. Should have it pushed to dev over the next few days. The way it will work is to to use:

experimental_functional_support=True

...in Scan()

from talos.

mikkokotila avatar mikkokotila commented on July 17, 2024

This is now fixed in the current dev branch.

from talos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.