Skip to content

Commit 001843c

Browse files
authored
Merge pull request #137 from BukovnikMiha/feature/readme_visualization_update
Scatter plot and grouped matrix plot README visualization addition
2 parents d2e8e95 + 6792b81 commit 001843c

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed
115 KB
Loading

.github/images/scatter_plot.png

94.3 KB
Loading

README.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,15 @@ and equations can be found [here](interest_measures.md).
179179

180180
### Visualization
181181

182-
The framework currently supports the hill slopes visualization method presented in [4]. More visualization methods are planned
183-
to be implemented in future releases.
182+
The framework currently supports:
183+
184+
- hill slopes (presented in [4]),
185+
- scatter plot and
186+
- grouped matrix plot visualization methods.
187+
188+
More visualization methods are planned to be implemented in future releases.
189+
190+
#### Hill Slopes
184191

185192
```python
186193
from matplotlib import pyplot as plt
@@ -199,6 +206,67 @@ plt.show()
199206
<img alt="logo" src="https://raw.githubusercontent.com/firefly-cpp/NiaARM/main/.github/images/hill_slopes.png">
200207
</p>
201208

209+
#### Scatter Plot
210+
211+
```python
212+
from examples.visualization_examples.prepare_datasets import get_weather_data
213+
from niaarm import Dataset, get_rules
214+
from niaarm.visualize import scatter_plot
215+
216+
# Get prepared data
217+
arm_df = get_weather_data()
218+
219+
# Prepare Dataset
220+
dataset = Dataset(path_or_df=arm_df,delimiter=",")
221+
222+
# Get rules
223+
metrics = ("support", "confidence")
224+
rules, run_time = get_rules(dataset, "DifferentialEvolution", metrics, max_evals=500)
225+
226+
# Add lift to metrics
227+
metrics = list(metrics)
228+
metrics.append("lift")
229+
metrics = tuple(metrics)
230+
231+
# Visualize scatter plot
232+
fig = scatter_plot(rules=rules, metrics=metrics, interactive=False)
233+
fig.show()
234+
```
235+
236+
<p>
237+
<img alt="logo" src=".github/images/scatter_plot.png">
238+
</p>
239+
240+
#### Grouped Matrix Plot
241+
242+
```python
243+
from examples.visualization_examples.prepare_datasets import get_football_player_data
244+
from niaarm import Dataset, get_rules
245+
from niaarm.visualize import grouped_matrix_plot
246+
247+
# Get prepared data
248+
arm_df = get_football_player_data()
249+
250+
# Prepare Dataset
251+
dataset = Dataset(path_or_df=arm_df, delimiter=",")
252+
253+
# Get rules
254+
metrics = ("support", "confidence")
255+
rules, run_time = get_rules(dataset, "DifferentialEvolution", metrics, max_evals=500)
256+
257+
# Add lift to metrics
258+
metrics = list(metrics)
259+
metrics.append("lift")
260+
metrics = tuple(metrics)
261+
262+
# Visualize grouped matrix plot
263+
fig = grouped_matrix_plot(rules=rules, metrics=metrics, k=5, interactive=False)
264+
fig.show()
265+
```
266+
267+
<p>
268+
<img alt="logo" src=".github/images/grouped_matrix_plot.png">
269+
</p>
202270

203271
### Text Mining (Experimental)
204272

0 commit comments

Comments
 (0)