Comments (7)
@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.
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.
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.
@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.
@ben0it8 This issue has been addressed in PR #104 and should resolve your problem.
from hyperas.
@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.
@pkainz Thank you so much.
from hyperas.
Related Issues (20)
- NameError: name 'train_predict' is not defined HOT 5
- Cross validation inside 'data' function HOT 5
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 885: illegal multibyte sequence
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 885: illegal multibyte sequence
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 885: illegal multibyte sequence HOT 3
- Optmizing CNN - TypeError: module, class, method, function, traceback, frame, or code object was expected, got tuple HOT 2
- Cannot run hyperas on databricks, [Errno 2] No such file or directory: "/databrikcs/driver/notebook_name" HOT 1
- custom def on kernel_initializer
- How can it be guaranteed to run all combinations if only "choice" is used.
- AttributeError: 'numpy.random.mtrand.RandomState' object has no attribute 'integers' HOT 13
- KeyError: job exception: 'val_acc' HOT 2
- Can Hyperas natively return data regarding all models ran during an optimization cycle? HOT 1
- Why hyperas is executing Raw Text as code HOT 1
- AttributeError: numpy.random.mtrand.RandomState object has no attribute 'integers'
- global variable issue HOT 2
- module 'hyperopt.pyll' has no attribute 'base' HOT 1
- getting issue in this code is there anyone can help me out? It will be greatfull... #Building another model/classifier ISOLATION FOREST from sklearn.ensemble import IsolationForest ifc=IsolationForest(max_samples=len(X_train), contamination=outlier_fraction,random_state=1) ifc.fit(X_train) scores_pred = ifc.decision_function(X_train) y_pred = ifc.predict(X_test) # Reshape the prediction values to 0 for valid, 1 for fraud. y_pred[y_pred == 1] = 0 y_pred[y_pred == -1] = 1 n_errors = (y_pred != Y_test).sum()
- getting issue in this code is there anyone can help me out? It will be greatfull... HOT 1
- I am having error of No such file or directory: 'C:\\Users\\fnur42\\AppData\\Local\\Temp\\ipykernel_3156\\3188587457.py'.This error shows in the best_run,best_model line. What is ipykernel file and how I can create it?
- I always have this error after executing the following code : NameError: name 'x_train' is not defined HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyperas.