Skip to content

Commit 1163a25

Browse files
committed
add splines to preprocessor
1 parent 57e7a82 commit 1163a25

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

mambular/utils/preprocessor.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,19 @@ def fit(self, X, y=None):
236236
numeric_transformer_steps.append(
237237
(
238238
"polynomial",
239-
PolynomialFeatures(self.degree, include_bias=True),
239+
PolynomialFeatures(self.degree, include_bias=False),
240240
)
241241
)
242242

243243
elif self.numerical_preprocessing == "splines":
244244
numeric_transformer_steps.append(
245245
(
246246
"splines",
247-
SplineTransformer(degree=self.degree, n_knots=self.n_knots),
247+
SplineTransformer(
248+
degree=self.degree,
249+
n_knots=self.n_knots,
250+
include_bias=False,
251+
),
248252
),
249253
)
250254

@@ -477,13 +481,15 @@ def get_feature_info(self):
477481
# Handle other numerical feature encodings
478482
else:
479483
last_step = transformer_pipeline.steps[-1][1]
484+
step_names = [step[0] for step in transformer_pipeline.steps]
485+
step_descriptions = " -> ".join(step_names)
480486
if hasattr(last_step, "transform"):
481487
transformed_feature = last_step.transform(
482488
np.zeros((1, len(columns)))
483489
)
484490
other_encoding_info[feature_name] = transformed_feature.shape[1]
485491
print(
486-
f"Feature: {feature_name} (Other Encoding), Encoded feature dimension: {transformed_feature.shape[1]}"
492+
f"Feature: {feature_name} ({step_descriptions}), Encoded feature dimension: {transformed_feature.shape[1]}"
487493
)
488494

489495
print("-" * 50)

0 commit comments

Comments
 (0)