Code Monkey home page Code Monkey logo

Comments (7)

pkainz avatar pkainz commented on September 28, 2024 5

@resuly To get the real value, you need to evaluate the hyperparameter space.

Option 1 - from scratch
Change the call to the optimization function to this one:

best_run, best_model, space = optim.minimize(
    model=model,
    data=data,
    algo=tpe.suggest,
    max_evals=5,
    trials=Trials(),
    eval_space=True,   # <-- this is the line that puts real values into 'best_run'
    return_space=True  # <-- this allows you to save the space for later evaluations 
) 

Option 2 - after having run the optimizations
You need access to your hyperparameter space that gets created by the hyperopt package and the parameter dict (the ones you posted in your last comment). Then you can use the function hyperas.utils.eval_hyperopt_space(space, vals) to extract the real values, e.g.:

from hyperas.utils import eval_hyperopt_space
real_param_values = eval_hyperopt_space(space, best_run)

from hyperas.

maxpumperla avatar maxpumperla commented on September 28, 2024 1

That's a tough question, open research actually! It's to be expected that hyperas doesn't always find good solutions, since usually the space to explore is very high-dimensional. From a theoretical point of view TPE should yield the best results, followed by random search. Other than that you have to see what your specific problem requires.

I struggle with this type of question for my own projects as well, so at least you're in good company. :)

from hyperas.

ben0it8 avatar ben0it8 commented on September 28, 2024

Is there a way to return the best_run's actual parameter values instead of their indices , eg. in {{choice([a,b])}} 0 or 1? Unfortunately I cannot use space_eval() from hyperopt's fmin module. @maxpumperla

from hyperas.

pkainz avatar pkainz commented on September 28, 2024

@ben0it8 Check the complex.py example. The parameters are returned in best_run, to print them use e.g.

print("Parameters of best run", best_run)

EDIT
That's just working for non-choice cases.

from hyperas.

pkainz avatar pkainz commented on September 28, 2024

@ben0it8 This issue has been addressed in PR #104 and should resolve your problem.

from hyperas.

resuly avatar resuly commented on September 28, 2024

@pkainz After run this complex.py example, I got this result:

 {'Dropout': 0.03323327852409652, 'Dense': 2, 'Dropout_1': 0.0886198698550964, 'add': 1, 'conditional': 1, 'batch_size': 0, 'optimizer': 0, 'Activation': 1}

It that correct? My hyperas version is 0.4 and I want to get the real value for Dense and Activation.
How can I do that? Thanks

from hyperas.

resuly avatar resuly commented on September 28, 2024

@pkainz Thank you so much.

from hyperas.

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.