Esempio n. 1
0
class SampleConf(Bean):
    sample_strategy = StringField()
    percentage = IntegerField()
    n_rows = IntegerField()

    class Strategy:
        RandomRows = "random_rows"
        Percentage = "percentage"
        WholeData = "whole_data"
Esempio n. 2
0
class DatasetStats(Bean):
    label_col = StringField()
    file_path = StringField()
    has_header = BooleanField()
    n_rows = IntegerField()
    n_cols = IntegerField()
    features = ListBeanField(Feature)
    feature_summary = BeanField(FeatureTypeStats)
    create_datetime = IntegerField()

    @property
    def features_names(self):
        return [f.name for f in self.features]
Esempio n. 3
0
class JobStep(Bean):
    type = StringField()
    status = StringField()
    took = FloatField()
    datetime = IntegerField()
    extension = DictField()

    class Status:
        Succeed = "succeed"
        Failed = "failed"
Esempio n. 4
0
class FeatureMissing(Bean):
    value = IntegerField()
    percentage = FloatField()
    status = StringField()

    class Status:
        TooHigh = 'too_high'

    @staticmethod
    def calc_status(percentage):
        if percentage > 70:
            return FeatureMissing.Status.TooHigh
        else:
            return FeatureNormalStatus
Esempio n. 5
0
class TrainJobConf(Bean):
    framework = StringField()
    name = StringField()
    model_name = StringField()
    searcher = StringField()
    max_trails = IntegerField()
    search_space = StringField()

    class SearchSpace:
        Complex = "complex"
        Basic = "basic"
        Minimal = "minimal"

    class Searcher:
        RandomSearcher = 'random_searcher'
        EvolutionSearcher = 'evolution_searcher'
        MCTSSearcher = 'MCTS_searcher'
        EnasSearcher = 'Enas_searcher'
Esempio n. 6
0
class FeatureUnique(Bean):
    value = IntegerField()
    percentage = FloatField()
    status = StringField()

    class Status:
        ID_ness = 'ID-ness'
        Stable = 'stable'

    @staticmethod
    def calc_status(n_uniques, percentage):
        if n_uniques == 1:
            return FeatureUnique.Status.Stable
        else:
            if percentage > 90:
                return FeatureUnique.Status.ID_ness
            else:
                return FeatureNormalStatus
Esempio n. 7
0
class YearValueCount(Bean):
    year = IntegerField()
    value = IntegerField()
Esempio n. 8
0
class FeatureMode(Bean):
    value = StringField()
    count = IntegerField()
    percentage = FloatField()
Esempio n. 9
0
class FeatureValueCount(Bean):
    type = ObjectField()
    value = IntegerField()
    percentage = FloatField()
Esempio n. 10
0
class ContinuousFeatureBin(Bean):
    begin = ObjectField()
    end = ObjectField()
    value = IntegerField()
Esempio n. 11
0
class FeatureTypeStats(Bean):
    categorical = IntegerField(default=0)
    continuous = IntegerField(default=0)
    text = IntegerField(default=0)
    datetime = IntegerField(default=0)
Esempio n. 12
0
class FeatureValueCount(Bean):
    type = ObjectField()
    value = IntegerField()
Esempio n. 13
0
class Model(Bean):
    name = StringField()
    framework = StringField()
    dataset_name = StringField()
    model_file_size = IntegerField()
    no_experiment = IntegerField()
    inputs = ListBeanField(ModelFeature)
    task_type = StringField()
    performance = BeanField(Performance)
    model_path = StringField()
    status = StringField()
    pid = IntegerField()
    score = FloatField()
    progress = StringField()
    train_job_name = StringField()
    train_trail_no = IntegerField()
    trails = ListBeanField(TrainTrail)
    extension = DictField()
    create_datetime = DatetimeField()
    finish_datetime = DatetimeField()
    last_update_datetime = DatetimeField()

    def escaped_time(self):
        if self.status in [ModelStatusType.Succeed, ModelStatusType.Failed]:
            if self.finish_datetime is None:
                raise Exception(
                    "Internal error, train finished but has no finish_datetime. "
                )
            escaped = util.datetime_diff_human_format_by_minute(
                self.finish_datetime, self.create_datetime)
        else:
            escaped = util.datetime_diff_human_format_by_minute(
                util.get_now_datetime(), self.create_datetime)
        return escaped

    def escaped_time_by_seconds(self):
        if self.status in [ModelStatusType.Succeed, ModelStatusType.Failed]:
            if self.finish_datetime is None:
                raise Exception(
                    f"Internal error, model name = {self.name} train finished but has no finish_datetime. "
                )
            escaped = util.datetime_diff(self.finish_datetime,
                                         self.create_datetime)
        else:
            escaped = util.datetime_diff(util.get_now_datetime(),
                                         self.create_datetime)
        return escaped

    def default_metric(self):
        m = \
            {
                'multi_classification': "logloss",
                'regression': "mae",
                'binary_classification': "auc"
            }
        return m[self.task_type]

    def log_file_path(self):
        # exits begin from train start
        return util.relative_path(P.join(str(self.model_path), 'train.log'))

    def train_source_code_path(self):
        # exits begin from train start
        return util.relative_path(P.join(str(self.model_path), 'train.py'))

    def train_notebook_uri(self):
        # exits begin from train start
        train_notebook_path = P.join(str(self.model_path), 'train.ipynb')
        return util.relative_path(train_notebook_path)
Esempio n. 14
0
class TrainTrail(Bean):
    trail_no = IntegerField()
    reward = FloatField()
    elapsed = FloatField()
    params = DictField()
Esempio n. 15
0
class ConfusionMatrix(Bean):
    fn = IntegerField()
    fp = IntegerField()
    tn = IntegerField()
    tp = IntegerField()
    label = BeanField(BinaryLabel)
Esempio n. 16
0
class RespPreviewDataset(Bean):
    headers = ListObjectField()
    rows = ListObjectField()
    count = IntegerField()
    file_path = StringField()
Esempio n. 17
0
class CrossValidation(Bean):
    n_folds = IntegerField()
    holdout_percentage = IntegerField()
Esempio n. 18
0
class TrainValidationHoldout(Bean):
    train_percentage = IntegerField()
    validation_percentage = IntegerField()
    holdout_percentage = IntegerField()
Esempio n. 19
0
class TrainTrial(Bean):
    trial_no = IntegerField()
    status = StringField()
    extension = DictField()