mlinsights.helpers¶
Formatting¶
- mlinsights.helpers.parameters.format_parameters(pdict)[source]¶
Formats a list of parameters.
- Parameters:
pdict – dictionary
- Returns:
string
<<<
from mlinsights.helpers.parameters import format_parameters d = dict(i=2, x=6.7, s="r") print(format_parameters(d))
>>>
i=2, s='r', x=6.7
- mlinsights.helpers.parameters.format_value(v)[source]¶
Formats a value to be included in a string.
- Parameters:
v – a string
- Returns:
a string
- mlinsights.helpers.parameters.format_function_call(name, pdict)[source]¶
Formats a function call with named parameters.
param pdict: dictionary :return: string
<<<
from mlinsights.helpers.parameters import format_function_call d = dict(i=2, x=6.7, s="r") print(format_function_call("fct", d))
>>>
fct(i=2, s='r', x=6.7)
Pipeline¶
- mlinsights.helpers.pipeline.alter_pipeline_for_debugging(pipe)[source]¶
Overwrite methods transform, predict, predict_proba or decision_function to collect the last inputs and outputs seen in these methods.
- Parameters:
pipe – scikit-learn pipeline
The object pipe is modified, it should be copied before calling this function if you need the object untouched after that. The prediction is slower. See notebook Visualize a scikit-learn pipeline.
- mlinsights.helpers.pipeline.enumerate_pipeline_models(pipe, coor=None, vs=None)[source]¶
Enumerates all the models within a pipeline.
- Parameters:
pipe – scikit-learn pipeline
coor – current coordinate
vs – subset of variables for the model, None for all
- Returns:
iterator on models
tuple(coordinate, model)
See example Visualize a scikit-learn pipeline.