Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ability to pass an arch name to learner instead of class #217

Closed
oguiza opened this issue Sep 22, 2021 · 4 comments
Closed

added ability to pass an arch name to learner instead of class #217

oguiza opened this issue Sep 22, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@oguiza
Copy link
Contributor

oguiza commented Sep 22, 2021

No description provided.

@oguiza oguiza added the enhancement New feature or request label Sep 22, 2021
@oguiza oguiza closed this as completed in 3697209 Sep 22, 2021
@dnth
Copy link
Contributor

dnth commented Sep 22, 2021

I can imagine we will be able to do this soon with tsai and optuna? :)

model = trial.suggest_categorical("model", ["LSTM", "InceptionTimePlus", "TSTPlus", "MLP"])

@oguiza
Copy link
Contributor Author

oguiza commented Sep 22, 2021

I can imagine we will be able to do this soon with tsai and optuna? :)

model = trial.suggest_categorical("model", ["LSTM", "InceptionTimePlus", "TSTPlus", "MLP"])

Exactly! That's the intent of this new enhancement. 👍🏼

@dnth
Copy link
Contributor

dnth commented Sep 22, 2021

I tried something like this once upon a time using eval. But not sure if its got any down side?

    nf = trial.suggest_categorical('num_filters', [32, 64, 96]) 
    learning_rate = trial.suggest_float("learning_rate", 1e-5, 1e-2, log=True)  
    model = trial.suggest_categorical('model', ['InceptionTime', 'InceptionTimePlus'])

    batch_tfms = TSStandardize(by_sample=True)
    learn = TSClassifier(X, y, splits=splits, bs=[64, 128], batch_tfms=batch_tfms,
                         arch=eval(model), arch_config={'nf':nf},
                         metrics=accuracy, cbs=FastAIPruningCallback(trial))

@oguiza
Copy link
Contributor Author

oguiza commented Sep 22, 2021

I'm not sure about eval.

But with the current approach you can try this (I haven't tested it but I think it should work):

nf = trial.suggest_categorical('num_filters', [32, 64, 96]) 
learning_rate = trial.suggest_float("learning_rate", 1e-5, 1e-2, log=True)  
model = trial.suggest_categorical('model', ['InceptionTime', 'InceptionTimePlus'])

batch_tfms = TSStandardize(by_sample=True)
learn = TSClassifier(X, y, splits=splits, bs=[64, 128], batch_tfms=batch_tfms,
                     arch=model, arch_config={'nf':nf},
                     metrics=accuracy, cbs=FastAIPruningCallback(trial))

There shouldn't be any downsides with this approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants