Beispiel #1
0
 def test_hyperopt(self):
     job = Job.objects.create(
         split=create_test_split(split_type=SplitTypes.SPLIT_SINGLE.value,
                                 original_log=create_test_log(
                                     log_name=general_example_filename,
                                     log_path=general_example_filepath)),
         encoding=create_test_encoding(
             value_encoding=ValueEncodings.SIMPLE_INDEX.value,
             prefix_length=3,
             padding=False),
         labelling=create_test_labelling(
             label_type=LabelTypes.REMAINING_TIME.value),
         clustering=create_test_clustering(
             clustering_type=ClusteringMethods.KMEANS.value),
         predictive_model=create_test_predictive_model(
             predictive_model=PredictiveModels.CLASSIFICATION.value,
             prediction_method=ClassificationMethods.RANDOM_FOREST.value),
         hyperparameter_optimizer=create_test_hyperparameter_optimizer(
             hyperoptim_type=HyperparameterOptimizationMethods.HYPEROPT.
             value,
             performance_metric=HyperOptLosses.ACC.value,
             max_evals=2))
     prediction_task(job.pk)
     job = Job.objects.get(pk=1)
     self.assertFalse(classification_random_forest(
     ) == job.predictive_model.classification.__getattribute__(
         ClassificationMethods.RANDOM_FOREST.value.lower()).to_dict())
Beispiel #2
0
    def get_classification_job(predictive_model: str, prediction_method: str, metric: HyperOptLosses = HyperOptLosses.ACC.value):
        encoding = create_test_encoding(prefix_length=8, padding=True)
        pred_model = create_test_predictive_model(predictive_model=predictive_model,
                                                  prediction_method=prediction_method)
        hyperparameter_optimizer = create_test_hyperparameter_optimizer(performance_metric=metric)

        job = create_test_job(predictive_model=pred_model,
                              encoding=encoding,
                              hyperparameter_optimizer=hyperparameter_optimizer)
        return job
Beispiel #3
0
    def get_regression_job(predictive_model: str, prediction_method: str,
                           metric: HyperOptLosses = HyperOptLosses.ACC.value):
        encoding = create_test_encoding(prefix_length=8, padding=True)
        pred_model = create_test_predictive_model(predictive_model=predictive_model,
                                                  prediction_method=prediction_method)
        hyperparameter_optimizer = create_test_hyperparameter_optimizer(performance_metric=metric)

        job = create_test_job(predictive_model=pred_model,
                              encoding=encoding,
                              labelling=create_test_labelling(label_type=LabelTypes.REMAINING_TIME.value,
                                                              threshold_type=ThresholdTypes.NONE.value),
                              hyperparameter_optimizer=hyperparameter_optimizer)
        return job