Skip to content

Commit

Permalink
Merge pull request #149 from neulab/refine-feature-deserialization
Browse files Browse the repository at this point in the history
refine feature deserialization & remove `is_pre_computed`
  • Loading branch information
neubig authored May 5, 2022
2 parents 46973b6 + 3fa2834 commit 6767051
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
34 changes: 2 additions & 32 deletions backend/src/impl/default_controllers_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@
get_task_categories,
)
from explainaboard import metric as exb_metric
from explainaboard.feature import (
BucketInfo,
ClassLabel,
Position,
Sequence,
Set,
Span,
Value,
)
from explainaboard.feature import FeatureType
from explainaboard.info import SysOutputInfo
from explainaboard.loaders.loader_registry import get_supported_file_types_for_loader
from explainaboard.metric import MetricStats
Expand Down Expand Up @@ -271,31 +263,9 @@ def systems_analyses_post(body: SystemsAnalysesBody):
# add proper from_dict() methods in SDK
for feature_name, feature in system_output_info.features.items():
# TODO Feature is not getting from_dict()ed properly, hardcode for now:
_type = feature["_type"]
feature.pop("_type")
if _type == ClassLabel._type:
feature = ClassLabel(**feature)
elif _type == Sequence._type:
feature = Sequence(**feature)
elif _type == Set._type:
feature = Set(**feature)
elif _type == Position._type:
feature = Position(**feature)
elif _type == Span._type:
feature = Span(**feature)
elif _type == Value._type:
feature = Value(**feature)

bucket_info = (
None
if isinstance(feature, Sequence) or isinstance(feature, Set)
else feature.bucket_info
)

if bucket_info is not None:
bucket_info = BucketInfo(**bucket_info)
feature = FeatureType.from_dict(feature) # dict -> Feature

feature.bucket_info = bucket_info
# user-defined bucket info
if feature_name in custom_feature_to_bucket_info:
custom_bucket_info = custom_feature_to_bucket_info[feature_name]
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/Analysis/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface FeatureVal {
description: string | null | undefined;
id: null;
is_bucket: boolean;
is_pre_computed: boolean;
dtype?: string;
names?: string[];
names_file?: null;
Expand Down Expand Up @@ -108,7 +107,6 @@ export interface SystemInfoFeature {
description: string | null;
dtype?: string;
is_bucket: boolean;
is_pre_computed: boolean;
require_training_set: boolean;
_type: string;
}
Expand Down
4 changes: 0 additions & 4 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ components:
type: boolean
require_training_set:
type: boolean
is_pre_computed:
type: boolean
bucket_info:
# TODO(chihhao) define detailed fields
type: object
Expand Down Expand Up @@ -432,8 +430,6 @@ components:
type: boolean
require_training_set:
type: boolean
is_pre_computed:
type: boolean
bucket_info:
type: object
nullable: true
Expand Down

0 comments on commit 6767051

Please sign in to comment.