def test_next_activity_kmeans(self):
        self.max_diff = None
        job = create_test_job(
            clustering=create_test_clustering(
                clustering_type=ClusteringMethods.KMEANS.value),
            split=repair_example(),
            encoding=create_test_encoding(prefix_length=8, padding=True),
            labelling=create_test_labelling(
                label_type=LabelTypes.NEXT_ACTIVITY.value),
            predictive_model=create_test_predictive_model(
                predictive_model=PredictiveModels.CLASSIFICATION.value,
                prediction_method=ClassificationMethods.RANDOM_FOREST.value))
        result, _ = calculate(job)

        self.assertDictEqual(
            result, {
                'f1score': 0.54239884582595577,
                'acc': 0.80995475113122173,
                'true_positive': '--',
                'true_negative': '--',
                'false_negative': '--',
                'false_positive': '--',
                'precision': 0.62344720496894401,
                'recall': 0.5224945442336747,
                'auc': 0.4730604801339352
            })
 def test_class_no_cluster(self):
     self.max_diff = None
     job = create_test_job(
         clustering=create_test_clustering(
             clustering_type=ClusteringMethods.NO_CLUSTER.value),
         split=repair_example(),
         encoding=create_test_encoding(prefix_length=5,
                                       padding=True,
                                       add_elapsed_time=True),
         predictive_model=create_test_predictive_model(
             predictive_model=PredictiveModels.CLASSIFICATION.value,
             prediction_method=ClassificationMethods.RANDOM_FOREST.value))
     result, _ = calculate(job)
     self.assertDictEqual(
         result, {
             'f1score': 1.0,
             'acc': 1.0,
             'true_positive': '--',
             'true_negative': '--',
             'false_negative': '--',
             'false_positive': '--',
             'precision': 1.0,
             'recall': 1.0,
             'auc': 0
         })
 def test_regression_no_cluster(self):
     self.max_diff = None
     job = create_test_job(
         clustering=create_test_clustering(
             clustering_type=ClusteringMethods.NO_CLUSTER.value),
         split=repair_example(),
         encoding=create_test_encoding(prefix_length=5, padding=True),
         predictive_model=create_test_predictive_model(
             predictive_model=PredictiveModels.REGRESSION.value,
             prediction_method=RegressionMethods.RANDOM_FOREST.value))
     result, _ = calculate(job)
     self.assertAlmostEqual(result['rmse'], 0.03263757)
     self.assertAlmostEqual(result['mae'], 0.00011685)
     self.assertAlmostEqual(result['rscore'], 0.13776124)
     self.assertAlmostEqual(result['mape'], float('inf'))
 def test_regression_kmeans(self):
     self.max_diff = None
     job = create_test_job(
         clustering=create_test_clustering(
             clustering_type=ClusteringMethods.KMEANS.value),
         split=repair_example(),
         encoding=create_test_encoding(prefix_length=5, padding=True),
         predictive_model=create_test_predictive_model(
             predictive_model=PredictiveModels.REGRESSION.value,
             prediction_method=RegressionMethods.RANDOM_FOREST.value))
     result, _ = calculate(job)
     self.assertAlmostEqual(result['rmse'], 0.0325738)
     self.assertAlmostEqual(result['mae'], 0.00014269)
     self.assertAlmostEqual(result['rscore'], -0.11336870)
     self.assertAlmostEqual(result['mape'], float('inf'))
Beispiel #5
0
 def test_regression_kmeans(self):
     self.max_diff = None
     job = create_test_job(
         clustering=create_test_clustering(
             clustering_type=ClusteringMethods.KMEANS.value),
         split=repair_example(),
         encoding=create_test_encoding(prefix_length=5, padding=True),
         predictive_model=create_test_predictive_model(
             predictive_model=PredictiveModels.REGRESSION.value,
             prediction_method=RegressionMethods.RANDOM_FOREST.value))
     result, _ = calculate(job)
     self.assertAlmostEqual(result['rmse'], 0.036930128)
     self.assertAlmostEqual(result['mae'], 0.023046561975)
     self.assertAlmostEqual(result['rscore'], 0.99830687)
     self.assertAlmostEqual(result['mape'], 0.5761640)
    def test_next_activity_no_cluster(self):
        self.max_diff = None
        job = create_test_job(
            clustering=create_test_clustering(
                clustering_type=ClusteringMethods.NO_CLUSTER.value),
            split=repair_example(),
            encoding=create_test_encoding(prefix_length=8, padding=True),
            labelling=create_test_labelling(
                label_type=LabelTypes.NEXT_ACTIVITY.value),
            predictive_model=create_test_predictive_model(
                predictive_model=PredictiveModels.CLASSIFICATION.value,
                prediction_method=ClassificationMethods.RANDOM_FOREST.value))
        result, _ = calculate(job)

        self.assertAlmostEqual(result['f1score'], 0.5423988458)
        self.assertAlmostEqual(result['acc'], 0.809954751)
        self.assertAlmostEqual(result['precision'], 0.623447204)
        self.assertAlmostEqual(result['recall'], 0.52249454423)
        self.assertAlmostEqual(result['auc'], 0)
 def get_job():
     return create_test_job(split=repair_example(),
                            encoding=create_test_encoding(prefix_length=5,
                                                          padding=True),
                            job_type=JobTypes.LABELLING.value)