From 046a5abc77874710ad5e590bd0ca062f7feaa3e0 Mon Sep 17 00:00:00 2001 From: Nabeel Date: Thu, 13 Jun 2019 12:28:35 +1000 Subject: [PATCH] Second fix for regression Fix for regression where the response is numerical values --- core/__main__.py | 14 ++------------ core/_sklearn.py | 8 +------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/core/__main__.py b/core/__main__.py index ad98a93..cb3cd17 100644 --- a/core/__main__.py +++ b/core/__main__.py @@ -495,11 +495,7 @@ def _sklearn(request, context): # Get labels for clustering response = model.fit_transform(load_script=False) - # Set the correct data type for the response - if is_numeric_dtype(response): - dtypes = ["num"] - else: - dtypes = ["str"] + dtypes = ["str"] elif function in (15, 17, 28): if function == 15: @@ -512,13 +508,7 @@ def _sklearn(request, context): # Provide labels for clustering response = model.fit_transform(load_script=True) - # Set the correct data type for the response - if is_numeric_dtype(response.iloc[:,2]): - dt = "num" - else: - dt = "str" - - dtypes = ["str", "str", dt] + dtypes = ["str", "str", "str"] elif function in (18, 22): if function == 18: diff --git a/core/_sklearn.py b/core/_sklearn.py index 9034cfd..a328371 100644 --- a/core/_sklearn.py +++ b/core/_sklearn.py @@ -1530,13 +1530,7 @@ def _send_table_description(self, variant): elif variant == "predict": self.table.fields.add(name="model_name") self.table.fields.add(name="key") - - # We return numerical predictions for regression and text for classification - if self.model.estimator_type == "regressor": - dt = 1 - else: - dt = 0 - self.table.fields.add(name="prediction", dataType=dt) + self.table.fields.add(name="prediction") elif variant == "expression": self.table.fields.add(name="result") elif variant == "best_params":