Skip to content

More flexible interface for feature building #23

@odunbar

Description

@odunbar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions