Coder Social home page Coder Social logo

Comments (6)

mikkokotila avatar mikkokotila commented on May 24, 2024

@cynthia166 could you clean up the formatting of the above so it becomes more readable.

from talos.

cynthia166 avatar cynthia166 commented on May 24, 2024

Hello Miko,

I cleaned up the format:
My question is: How can i make the talos.Evaluate(scan_object) work I get an error becaus my x is multiple inputs, and the error says that list has no shape.

My code:

def autoEncoder(x_train, y_train, x_val, y_val, params):
    '''
    Autoencoder for Collaborative Filter Model
    '''
    #model = Sequential()
    #users_items_matrix, content_info = X
    #content_info = X[:,420:X.shape[1]]
    #users_items_matrix = X[:,0:420]
    # Input
    input_layer   = Input(shape=(420,), name='UserScore')
    input_content = Input(shape=(50,), name='Itemcontent')
    
    # Encoder
    # -----------------------------
    enc = Dense(512, activation=params["activation"], name='EncLayer1')(input_layer)

    # Content Information
    #embbeding Turns positive integers (indexes) into dense vectors of fixed size.
    x_content = Embedding(100, params['firtr_neurons'], input_length=50)(input_content)
    x_content = Flatten()(x_content)
    x_content = Dense(params['firtr_neurons'], activation=params["activation"], 
                                name='ItemLatentSpace')(x_content)
    # Latent Space
    # -----------------------------
    # Dropout layer randomly sets input units to 0 with a frequency of rate at each step during training time, which helps prevent overfitting. Inputs not set to 0 are scaled up by 1/(1 - rate) such that the sum over all inputs is unchanged.
    lat_space = Dense(params['firtr_neurons'], activation=params["activation"], name='UserLatentSpace')(enc)
    
    lat_space= add([lat_space, x_content], name='LatentSpace')
    lat_space = Dropout(params["dropout"], name='Dropout')(lat_space) # Dropout

    # Decoder
    # -----------------------------
    dec = Dense(params['firtr_neurons']*2, activation=params["activation"], name='DecLayer1')(lat_space)

    # Output
    output_layer = Dense(420, activation='linear', name='UserScorePred')(dec)

    # this model maps an input to its reconstruction
    model = Model([input_layer, input_content], output_layer)    
    

#model.compile(optimizer = SGD(lr=0.0001), loss='mse')
    model.compile(
     optimizer="Adam",
    loss='mean_squared_error',)
    model.summary()
    out = model.fit(x=x_train,
                    y=y_train,
                    validation_data=(x_val, y_val),
                    epochs=50,
                    batch_size=params['batch_size'],
                    verbose=0)
    return  out,model


p = {#'lr': (0.5, 5, 10),
     #'hidden_layers':[0, 1, 2],
     'batch_size': [50,100,150],
     'epochs': [50,60],
     #'times':[216,300,600],
     'firtr_neurons':[216,316],
     'dropout': [  .8,.9],
     #'weight_regulizer':[None],
     #'emb_output_dims': [None],
     #'optimizer': ["Adam", "Nadam", "RMSprop"],
     'activation':[ "selu","relu"],
     }

  scan_object = ta.Scan(x=[x_train, x1_train],
                          y=y_train,
                          x_val=[x_val, x1_val],
                          y_val=y_val,
                          params=p,
                          model=autoEncoder,
                        experiment_name="1",
                         
                        )

talos.Evaluate(scan_object)

from talos.

cynthia166 avatar cynthia166 commented on May 24, 2024

Thank you so much :)

from talos.

cynthia166 avatar cynthia166 commented on May 24, 2024

image

from talos.

mikkokotila avatar mikkokotila commented on May 24, 2024

Sorry for not replying earlier. Have you looked at this example for multiple inputs: https://autonomio.github.io/talos/#/Examples_Multiple_Inputs

from talos.

mikkokotila avatar mikkokotila commented on May 24, 2024

This will be handled in #582 so merging with that.

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.