Skip to content

Commit 6bdf551

Browse files
#660 Enable Power Transformations Update (#1086)
* Power Transformer * Correct typo * ADD_630 * PEP8 compliance * Fix target type Co-authored-by: MaxGreil <[email protected]>
1 parent a119e7f commit 6bdf551

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from autosklearn.pipeline.constants import DENSE, UNSIGNED_DATA, INPUT
2+
from autosklearn.pipeline.components.data_preprocessing.rescaling.abstract_rescaling \
3+
import Rescaling
4+
from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm
5+
6+
7+
class PowerTransformerComponent(Rescaling, AutoSklearnPreprocessingAlgorithm):
8+
def __init__(self, random_state):
9+
from sklearn.preprocessing import PowerTransformer
10+
self.preprocessor = PowerTransformer(copy=False)
11+
12+
@staticmethod
13+
def get_properties(dataset_properties=None):
14+
return {'shortname': 'PowerTransformer',
15+
'name': 'PowerTransformer',
16+
'handles_missing_values': False,
17+
'handles_nominal_values': False,
18+
'handles_numerical_features': True,
19+
'prefers_data_scaled': False,
20+
'prefers_data_normalized': False,
21+
'handles_regression': True,
22+
'handles_classification': True,
23+
'handles_multiclass': True,
24+
'handles_multilabel': True,
25+
'handles_multioutput': True,
26+
'is_deterministic': True,
27+
# TODO find out of this is right!
28+
'handles_sparse': False,
29+
'handles_dense': True,
30+
'input': (DENSE, UNSIGNED_DATA),
31+
'output': (INPUT,),
32+
'preferred_dtype': None}

test/test_pipeline/test_classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def test_get_hyperparameter_search_space(self):
421421
forbiddens = cs.get_forbiddens()
422422

423423
self.assertEqual(len(cs.get_hyperparameter(
424-
'data_preprocessing:numerical_transformer:rescaling:__choice__').choices), 6)
424+
'data_preprocessing:numerical_transformer:rescaling:__choice__').choices), 7)
425425
self.assertEqual(len(cs.get_hyperparameter(
426426
'classifier:__choice__').choices), 16)
427427
self.assertEqual(len(cs.get_hyperparameter(

0 commit comments

Comments
 (0)