File size: 593 Bytes
f1d873d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Setup execution
ml_components = load_ml_components(fp=ml_core_fp)
idx_to_labels = {i: l for (i, l) in enumerate(ml_components["labels"])}
end_2_end_pipeline = ml_components["pipeline"]


            # Prediction
            pred_output = end_2_end_pipeline.predict_proba(df_input)

            class_idx = pred_output.argmax(axis=1)
            scores = pred_output[:, class_idx]
            df_input['predicted_class'] = class_idx
            df_input['predicted_class'] = df_input['predicted_class'].replace(
                idx_to_labels)
            df_input['confidence_score'] = scores