-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkedro.py
More file actions
32 lines (26 loc) · 811 Bytes
/
Copy pathkedro.py
File metadata and controls
32 lines (26 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from kedro.pipeline import Pipeline, node
from kedro.runner import SequentialRunner
from kedro.io import DataCatalog
# 1. Node function
def create_messages():
import pandas as pd
return pd.DataFrame({"message": ["hello", "world"]})
# 2. Pipeline definition
pipeline = Pipeline([
node(
func=create_messages,
inputs=None, # No inputs
outputs="msgs_df",
name="create_messages_node"
)
])
# 3. Run it
catalog = DataCatalog()
runner = SequentialRunner()
result = runner.run(pipeline=pipeline, catalog=catalog)
print(result["msgs_df"])
"""
proba = model.predict_proba(X) # shape: (n_samples, 2)
p1 = proba[:, 1] # probability of class 1 (if classes_ = [0,1])
y_pred = (p1 >= 0.7).astype(int) # threshold = 0.7 (example)
"""