Пример #1
0
def conv_rate_plus_100_feature_view(
    inputs: Dict[str, Union[RequestDataSource, FeatureView]],
    infer_features: bool = False,
    features: Optional[List[Feature]] = None,
) -> OnDemandFeatureView:
    _features = features or [
        Feature("conv_rate_plus_100", ValueType.DOUBLE),
        Feature("conv_rate_plus_val_to_add", ValueType.DOUBLE),
    ]
    return OnDemandFeatureView(
        name=conv_rate_plus_100.__name__,
        inputs=inputs,
        features=[] if infer_features else _features,
        udf=conv_rate_plus_100,
    )
Пример #2
0
def similarity_feature_view(
    inputs: Dict[str, Union[RequestDataSource, FeatureView]],
    infer_features: bool = False,
    features: Optional[List[Feature]] = None,
) -> OnDemandFeatureView:
    _features = features or [
        Feature("cos_double", ValueType.DOUBLE),
        Feature("cos_float", ValueType.FLOAT),
    ]
    return OnDemandFeatureView(
        name=similarity.__name__,
        inputs=inputs,
        features=[] if infer_features else _features,
        udf=similarity,
    )
Пример #3
0
def conv_rate_plus_100_feature_view(
    sources: Dict[str, Union[RequestSource, FeatureView]],
    infer_features: bool = False,
    features: Optional[List[Field]] = None,
) -> OnDemandFeatureView:
    # Test that positional arguments and Features still work for ODFVs.
    _features = features or [
        Field(name="conv_rate_plus_100", dtype=Float64),
        Field(name="conv_rate_plus_val_to_add", dtype=Float64),
        Field(name="conv_rate_plus_100_rounded", dtype=Int32),
    ]
    return OnDemandFeatureView(
        name=conv_rate_plus_100.__name__,
        schema=[] if infer_features else _features,
        sources=sources,
        udf=conv_rate_plus_100,
    )
Пример #4
0
def similarity_feature_view(
    sources: Dict[str, Union[RequestSource, FeatureView]],
    infer_features: bool = False,
    features: Optional[List[Feature]] = None,
) -> OnDemandFeatureView:
    _fields = [
        Field(name="cos_double", dtype=Float64),
        Field(name="cos_float", dtype=Float32),
    ]
    if features is not None:
        _fields = [Field.from_feature(feature) for feature in features]

    return OnDemandFeatureView(
        name=similarity.__name__,
        sources=sources,
        schema=[] if infer_features else _fields,
        udf=similarity,
    )