Total Complexity | 3 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | finetuned_opt = OptPipe([("first", FooOpt())("second", BarOpt(params))], more_params) |
||
2 | |||
3 | column_transformer = BetterColumnTransformer( |
||
4 | [ |
||
5 | {"name": "num", "transformer": StandardScaler(), "columns": ["age", "income"]}, |
||
6 | {"name": "cat", "transformer": OneHotEncoder(), "columns": ["gender", "city"]}, |
||
7 | ] |
||
8 | ) |
||
9 | |||
10 | |||
11 | class MyPipeline(Pipeline): |
||
12 | def transform(self, data): |
||
13 | numeric = self.columns(["age", "income"]).apply(StandardScaler()) |
||
14 | categorical = self.columns(["gender", "city"]).apply(OneHotEncoder()) |
||
15 | combined = self.concat(numeric, categorical) |
||
16 | return combined.then(SVC()) |
||
17 | |||
18 | |||
19 | finetuned_opt = OptPipe(more_params) |
||
20 | finetuned_opt.add_step(RandomOpt(), fraction=0.3) |
||
21 | finetuned_opt.add_step(fraction=0.4) |
||
22 | finetuned_opt.add_step(fraction=0.3) |
||
23 | |||
24 | finetuned_opt |
||
25 | |||
26 | |||
27 | class OptPipe: |
||
28 | def __init__(self, a, b, c): |
||
29 | self.a = a |
||
30 | self.b = b |
||
31 | self.c = c |
||
32 | |||
33 | def set_params(self): |
||
34 | # einzige Möglichkeit um a b c zu ändern |
||
35 | pass |
||
36 |