LECA.analyze.plot_2D
- LECA.analyze.plot_2D(wf: WorkFlow, model: str | List[str], feature_dict: Dict[str, List[float]], temp: int | float, beta_0: int | float, steps: int = 50, restriction: List[str] = ['x_EC', 'x_EMC', 'x_LiSalt'], multiply_by_salt: bool = False, log: bool = False, focus: bool | DataFrame = False, save_loc: str | bool = False, objective: str = 'log conductivity', **kwargs) None
2-dimensional slice along two features for predicted conductivity / log(conductivity). The function can be used for model(s) trained directly on ionic conductivity or trained on the Arrhenius objectives. A single plot will be rendered which shows the predictions for the given feature ranges/values.
- Parameters:
wf (WorkFlow) – LECA WorkFlow object containing the trained model(s) for predicting the objective function (generally “log conductivity”).
model (Union[str, List[str]]) – String or list of string names of model(s) to use for prediction. If a single string is passed, the same model is used for all objectives. If the WorkFlow is trained on Arrhenius objectives they are then back-transformed.
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.
temp (Union[int, float]) – Temperature to use for plotting predictions.
beta_0 (Union[int, float]) – beta_0 value for the Arrhenius fits for the WorkFlow to be plotted (See
prep.arrhenius()orprep.direct_sample_arrhenius()). If the value ``-1`` is passed, this signifies that the WorkFlow doesn’t use the Arrhenius surrogate model and the predictions are not back-transformed.steps (int) –
Number of steps for generating values between feature_dict[feature]: min to max.
Default value
50restriction (List[str]) –
Set limited feature values. If the sum of the input features declared in this list is greater than 1, the prediction is excluded. This argument can be used to set boundaries for impossible electrolyte compositions.
Default value
['x_EC', 'x_EMC', 'x_LiSalt']multiply_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
Falsefocus (Union[bool, pd.DataFrame]) –
If False, do nothing. If pd.DataFrame (1-row DataFrame with input features columns) a black circle will be plotted on the 2D plots corresponding to the focus point.
Default value
Falsesave_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: save_loc+’slice_2D_{varied_features}.pdfDefault value
Falseobjective (str) –
String name of the objective function for the trained models in the WorkFlow.
Default value
'log conductivity'**kwargs – Keyword arguments passed to matplotlib.pyplot.countourf.
- Return type:
None