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

Access normalizer_fn #80

Open
sgvignali opened this issue Jan 26, 2021 · 1 comment
Open

Access normalizer_fn #80

sgvignali opened this issue Jan 26, 2021 · 1 comment

Comments

@sgvignali
Copy link

Is there a way to access the values learned by a fitted feature specification?
Like the mean and standard deviation learned by the scaler_standard() function, or
the values for vocabulary of categorical variables?

Thanks,
Sergio

@sgvignali
Copy link
Author

I reply to myself.
Let's say that the first step is a step_numeric_column, the normalizer function can be accessed so:

spec$steps[[1]]$normalizer_fn

and the mean and sd as following:

as.list(environment(spec$steps[[1]]$normalizer_fn))

The problem is that the mean and the sd are defined in the StandardScaler object that is not stored in the StepNumericColumn (only the function is stored after calling the method fit_resume).

With this setting, the object cannot be saved, and in a new R session the pointer to the normalizer function is lost.
It would be important to be able to save the specification, in order to avoid the need of re-fitting the object.

The same applies to the min_max_scaler function.
Maybe a possible solution would be to store the whole StandardScaler object and call the function only in the feature method?

Could please someone have a look at it?

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

No branches or pull requests

1 participant