LECA.analyze.plot_1D
- LECA.analyze.plot_1D(wfs: List[WorkFlow], models: List[str], feature_dict: Dict[str, List[float]], beta_0_list: List[float], temperatures: int | float | List[int] | List[float] = 20, steps: int = 50, ylim: Tuple[float, float] | None = None, multiply_by_salt: bool = False, log: bool = False, model_labels: List[str] | None = None, wf_labels: List[str] | None = None, min_max: bool = False, confidence: float = 1.0, save_loc: str | bool = False, objective: str = 'log conductivity', indicate_max: Tuple[str | None, int | float, int | float] = (None, 0.8, -1)) None
1-dimensional slice along one feature for models predicted conductivity / log(conductivity). The function can be used for models trained directly on ionic conductivity or trained on the Arrhenius objectives. A single plot will be rendered which shows the predictions for the argument defined WorkFlow(s) for every model at every temperature for the given feature ranges/values.
- Parameters:
wfs (List[WorkFlow]) – List of LECA WorkFlow object(s) containing trained models for the single objective function (generally “log conductivity”). Each WorkFlow in the wfs list should correspond to a WorkFlow label and beta_0 value in the wf_labels list and beta_0_list arguments, respectively.
models (List[str]) – List of string names of model(s) to use for prediction.
feature_dict (Dict[str, List[float]]) – Dictionary with input feature names as keys, and either [min, max] as values, or a list of explicit values [val0, val1, val2, …] to be used to generate predictions.
beta_0_list (List[float]) – List of the beta_0 values for the Arrhenius fits for each trained WorkFlow to be plotted (See
prep.arrhenius()orprep.direct_sample_arrhenius()). If the value ``-1`` is passed in the list, this signifies that the WorkFlow doesn’t use the Arrhenius surrogate model and the predictions are not back-transformed.temperatures (Union[int, float, List[int], List[float]]) –
Set of temperature(s) to use for plotting predictions.
Default value
20steps (int) –
Number of steps for generating values between feature_dict[feature]: min to max.
Default value
50ylim (Optional[Tuple[float,float]]) –
Optional parameter to set fixed boundaries for the y-axis of the plot.
Default value
Nonemultiply_by_salt (bool) –
Whether to multiply the prediction by the salt content (feature: “x_LiSalt”). This is necessary to back-transform to conductivity if the models were trained with the objective function conductivity/x_Lisalt.
Default value
Falselog (bool) –
If log=True return log_{10}(conductivity). If log=False return conductivity.
Default value
Falsemodel_labels (Optional[List[str]]) –
String values for labeling the models in the plots. Can be useful for abbreviating otherwise verbose string model names. If
None, by default uses the model names given in the models argument.Default value
Nonewf_labels (Optional[List[str]]) –
Optionally append a label for different WorkFlows to the plotted predictions. If
Nonenothing is added. Note: If a list is passed, it should correspond 1:1 with the list of WorkFlows passed to the wfs argument.Default value
Nonemin_max (bool) –
Whether to use the min_max method to estimate uncertainty, or MAPIE with conformity scores. min_max:
Truereturns the standard deviations of the predictions from all the bootstrapped models for each point. min_max:Falseuses the MAPIE uncertainty estimation outlined in: Mapie jackknife+-AB This parameter is moot for GPR models.Default value
False.confidence (float) –
Scalar value to multiply the estimated uncertainty. By default this value is
1.0which results in the plotted errorbars showing one standard-deviation. E.g.confidence=1.96would then reflect an approximate 95% confidence interval.Default value
1.0save_loc (Union[str, bool]) –
Boolean or string to indicate whether and where to to save the plot. If
Falseno plot is saved, otherwise: Depending on other passed arguments, the naming scheme follows:multiply_by_salt==True and indicate_max[0] != None :: save_loc+’slice_1D_{varied_feature}_multiply_by_salt_indicate.pdf
multiply_by_salt==True and indicate_max[0] == None :: plt.savefig(save_loc+’slice_1D_{varied_feature}_multiply_by_salt.pdf
multiply_by_salt==False and indicate_max[0] != None :: plt.savefig(save_loc+’slice_1D_{varied_feature}_indicate.pdf
multiply_by_salt==False and indicate_max[0] == None :: plt.savefig(save_loc+’slice_1D_{varied_feature}.pdf
Default value
Falseobjective (str) –
String name of the objective function for the trained models in the WorkFlow.
Default value
'log conductivity'indicate_max (Tuple[Optional[str],Union[int, float],Union[int,float]]) –
indicate_max[0] :
Noneor String. If None do nothing, if String, plot a vertical dashed line indicating range of varied_feature within which the predicted objective is greater than indicate_max[1]*global_objectve_max as predicted by the model string name passed to indicate_max[0]. E.g. indicate_max[1]=0.8 plots the top 20th percentile objective value prediction range.indicate_max[2] : If
-1set the vertical dashed line limit as the minimum predicted objective value, otherwise, optionally set the objective value to which the vertical dashed lines are plotted. E.g. indicate_max[2]=0 will plot the vertical dashed lines to from the predicted objective value down to y=0.Default value
(None,0.8, -1))
- Return type:
None