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

More flexible interface for feature building #23

Open
odunbar opened this issue Oct 9, 2022 · 0 comments
Open

More flexible interface for feature building #23

odunbar opened this issue Oct 9, 2022 · 0 comments

Comments

@odunbar
Copy link
Collaborator

odunbar commented Oct 9, 2022

Features could allow arg/distribution combination based on a different variety of distributions and constructions.

Idea

Introduce a FeatureArgType type so build_features can create more flexible types with a build_args function dispatching over ::FeatureArgType
E.g. informally building the the classic scalar feature would involve:

abstract type FeatureArgType
Affine <: FeatureArgType

function build_args(
    samp::sampler, 
    feature_parameters::Dict, 
    inputs::Array,
    ::Affine,
)
    xi = get_distribution(samp)["xi"] 
    uniform = get_distribution(samp)["uniform"]
   return inputs*xi + uniform
end

replacing the hardcoded

samp = get_feature_sample(rf)
xi = get_distribution(samp)["xi"] # dim_inputs x n_features
features = inputs * xi[:, batch_feature_idx] # n_samples x n_features
is_uniform_shift = "uniform" get_name(samp)
if is_uniform_shift
uniform = get_distribution(samp)["uniform"] # 1 x n_features
features .+= uniform[:, batch_feature_idx]
end

  • Possibly move the move the inbuilt uniform distribution elsewhere? It's only in the fourier case that this is necessary
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