salesforce / Merlion

Merlion: A Machine Learning Framework for Time Series Intelligence
BSD 3-Clause "New" or "Revised" License
3.43k stars 302 forks source link

[BUG] merlin/plot.py - #156

Open ravenrip opened 1 year ago

ravenrip commented 1 year ago

Describe the bug Unable to run plot.py without error: ValueError: Multi-dimensional indexing (e.g. obj[:, None]) is no longer supported. Convert to a numpy array before indexing instead.

To Reproduce Run code from tutorial: for model in [model1, model2, model3]: print(type(model).name) fig, ax = model.plot_anomaly( time_series=test_data, time_series_prev=train_data, filter_scores=True, plot_time_series_prev=True) plot_anoms(ax=ax, anomaly_labels=test_labels) plt.show() print()

Expected behavior Plot the Anamalies based on model

Screenshots Worked after adding image

Desktop (please complete the following information):

Additional context Resolved by updating Line 219 & 246: ln = ax.plot(np.array(y.index), y.np_values, c="k", alpha=0.8, lw=1, zorder=1, label=metric_name)