Skip to content

Commit e72132f

Browse files
committed
Introduced option to specify target_index for score code
1 parent 5e8d8fd commit e72132f

File tree

2 files changed

+145
-116
lines changed

2 files changed

+145
-116
lines changed

src/sasctl/pzmm/import_model.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def import_model(
198198
predict_threshold: Optional[float] = None,
199199
target_values: Optional[List[str]] = None,
200200
overwrite_project_properties: Optional[bool] = False,
201+
target_index: Optional[int] = None,
201202
**kwargs,
202203
) -> Tuple[RestObj, Union[dict, str, Path]]:
203204
"""
@@ -275,10 +276,16 @@ def import_model(
275276
target_values : list of strings, optional
276277
A list of target values for the target variable. This argument and the
277278
score_metrics argument dictate the handling of the predicted values from
278-
the prediction method. The default value is None.
279+
the prediction method. The order of the target values should reflect the
280+
order of the related probabilities in the model. The default value is None.
279281
overwrite_project_properties : bool, optional
280282
Set whether the project properties should be overwritten when attempting to
281283
import the model. The default value is False.
284+
target_index : int, optional
285+
Sets the index of success for a binary model. If target_values are given, this
286+
index should match the index of the target outcome in target_values. If target_values
287+
are not given, this index should indicate whether the the target probability variable
288+
is the first or second variable returned by the model. The default value is 1.
282289
kwargs : dict, optional
283290
Other keyword arguments are passed to the following function:
284291
* sasctl.pzmm.ScoreCode.write_score_code(...,
@@ -352,6 +359,7 @@ def import_model(
352359
target_values=target_values,
353360
missing_values=missing_values,
354361
score_cas=score_cas,
362+
target_index=target_index,
355363
**kwargs,
356364
)
357365
if score_code_dict:
@@ -451,6 +459,7 @@ def import_model(
451459
target_values=target_values,
452460
missing_values=missing_values,
453461
score_cas=score_cas,
462+
target_index=target_index,
454463
**kwargs,
455464
)
456465
if score_code_dict:

0 commit comments

Comments
 (0)