dict
call - write as literal1302 json_dict[1]["data"][j].update(roc_dict[j])
1303 fitstat_data = None
1304 if roc_dict[j]["dataMap"]["_KS_"] == 1:
1305 fitstat_data = dict()1306 missing_stats = (
1307 "_KS_",
1308 "_KS2_",
list
call - write as literal2682 var_importances = var_importances.sort_values(
2683 by=["RelVarImportance"], ascending=False
2684 ).reset_index(drop=True)
2685 relative_importances = list()2686 for index, row in var_importances.iterrows():
2687 if row["Variable"] in interval_vars:
2688 level = "INTERVAL"
list
call - write as literal2757 roc_table = json.load(roc_file)
2758 correct_text = ["CORRECT", "INCORRECT", "CORRECT", "INCORRECT"]
2759 outcome_values = ["1", "0", "0", "1"]
2760 misc_data = list()2761 # Iterates through ROC table to get TRAIN, TEST, and VALIDATE data with a cutoff of .5
2762 for i in range(50, 300, 100):
2763 roc_data = roc_table["data"][i]["dataMap"]
list
call - write as literal2613
2614 # Load actionset necessary to generate variable importance
2615 conn.loadactionset("dataPreprocess")
2616 request_packages = list()2617 if target_type == "classification":
2618 method = "DTREE"
2619 treeCrit = "Entropy"
list
call - write as literal2624 raise RuntimeError(
2625 "The selected model type is unsupported. Currently, only models that have prediction or classification target types are supported."
2626 )
2627 request_packages = list()2628 if interval_vars:
2629 request_packages.append(
2630 {
Using the literal syntax can give minor performance bumps compared to using function calls to create dict
, list
and tuple
.
In [1]: timeit.timeit(stmt="dict()", number=100000000)
Out[1]: 9.560388602000103
In [2]: timeit.timeit(stmt="{}", number=100000000)
Out[2]: 1.685333584000091
In [3]: timeit.timeit(stmt="tuple()", number=100000000)
Out[3]: 4.509182139000131
In [4]: timeit.timeit(stmt="()", number=100000000)
Out[4]: 0.5455615430000762
In [5]: timeit.timeit(stmt="list()", number=100000000)
Out[5]: 7.356000728000254
In [6]: timeit.timeit(stmt="[]", number=100000000)
Out[6]: 1.573771306999788
This is because here, the name dict
must be looked up in the global scope in case it has been rebound.
Same goes for the other two types list()
and tuple()
.