Skip to content

Commit b2a9f3f

Browse files
adapting linearmodel and it's tests to use sklearn-only approach
1 parent 7bc8f04 commit b2a9f3f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pymc_experimental/preprocessing/__init__.py

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pandas as pd
2+
from sklearn.base import BaseEstimator, TransformerMixin
3+
from sklearn.preprocessing import StandardScaler
4+
5+
6+
class StandardScalerDF(StandardScaler, TransformerMixin, BaseEstimator):
7+
def __init__(self, with_mean=True, with_std=True):
8+
super().__init__(with_mean=with_mean, with_std=with_std)
9+
10+
def transform(self, X, y=None):
11+
z = super().transform(X)
12+
return pd.DataFrame(z, index=X.index, columns=X.columns)
13+
14+
def fit_transform(self, X, y=None):
15+
z = super().fit_transform(X)
16+
return pd.DataFrame(z, index=X.index, columns=X.columns)

0 commit comments

Comments
 (0)