Skip to content

Commit

Permalink
add smartphone brand features example
Browse files Browse the repository at this point in the history
  • Loading branch information
MorganneDeWitte committed Jul 5, 2024
1 parent e112bb3 commit a8449de
Show file tree
Hide file tree
Showing 9 changed files with 305 additions and 308 deletions.
6 changes: 3 additions & 3 deletions docs/source/api_reference/api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ raw specifications might not be sufficient to provide comprehensive instructions
xaiographs.datasets.load_education_performance
xaiographs.datasets.load_education_performance_discretized
xaiographs.datasets.load_education_performance_why
xaiographs.datasets.load_smartphone_brand_preferences
xaiographs.datasets.load_smartphone_brand_preferences_discretized
xaiographs.datasets.load_smartphone_brand_preferences_why
xaiographs.datasets.load_phone_brand_preferences
xaiographs.datasets.load_phone_brand_preferences_discretized
xaiographs.datasets.load_phone_brand_preferences_why
```

3 changes: 2 additions & 1 deletion docs/source/contributors/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ XAIoGraphs has been developed by ***Applied AI & Privacy*** team (Telefónica In
* [Enrique Fernandez](https://github.com/QuiqueFdez)
* [Alejandro Manuel Arranz](https://github.com/cx02747)
* [Manuel Martín](https://github.com/mmarmar)
* [Morganne De Witte](https://www.linkedin.com/in/morgannedw/)
* [Mario Villaizan](https://github.com/mvvmvv)
* [Cesar García](https://github.com/cesarggtid)
* [David Cadenas](https://github.com/davidcadi)
* [Alejandra Maria Alonso](https://www.linkedin.com/in/alejandraalonsodiaz/)
* [Miguel Angel Martín](https://github.com/mamj-telefonica)
* [Oriol Arnau](https://github.com/oarnau)
* [Oriol Arnau](https://github.com/oarnau)
2 changes: 1 addition & 1 deletion docs/source/examples/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ XAIoGraphs contains a set of examples that can be executed as `entry points`:
| [COMPAS Reality](compas_reality.md) | compas_reality_example | 4230 | 7 | Binary |
| [Body Performace](body_performance.md) | body_performance_example | 13393 | 11 | Multi-Class (3) |
| [Education Performance](education_performance.md) | education_performance_example | 145 | 29 | Multi-Class (5) |
| [Smartphone Brand Preferences](smartphone_brand_preferences.md) | smartphone_brand_preferences_example | 981 | 17 | Multi-Class (5) |
| [Smartphone Brand Preferences](smartphone_brand_preferences.md) | smartphone_brand_preferences_example | 259 | 11 | Multi-Class (5) |


Use the entry points to see an example run with the XAIoGraphs library installed in a Python virtual environment
Expand Down
24 changes: 12 additions & 12 deletions docs/source/examples/smartphone_brand_preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ function:
>>> from xaiographs.datasets import load_phone_brand_preferences
>>> df_dataset = load_phone_brand_preferences()
>>> df_dataset.head(5)
brand model internal memory performance main camera selfie camera battery size screen size weight price release date age gender occupation
0 Samsung Galaxy S22 128 8.81 50 10 3700 6.1 167 528 25/02/2022 38 Female Data analyst
1 Apple iPhone 13 Pro 256 7.94 12 12 3065 6.1 204 999 24/09/2021 38 Female Data analyst
2 Google Pixel 6 A 128 6.76 50 8 4614 6.4 207 499 28/10/2021 31 Female sales
3 Samsung Galaxy S22 Plus 128 7.22 50 10 4500 6.6 195 899 25/02/2022 31 Female sales
4 Google Pixel 6a 128 6.88 12 8 4410 6.1 178 449 21/07/2021 27 Female Team leader
brand internal_memory performance main_camera selfie_camera battery_size screen size weight price age gender occupation
0 Samsung 128 8.81 50 10 3700 6.1 167 528 38 Female Data analyst
1 Apple 256 7.94 12 12 3065 6.1 204 999 38 Female Data analyst
2 Google 128 6.76 50 8 4614 6.4 207 499 31 Female sales
3 Samsung 128 7.22 50 10 4500 6.6 195 899 31 Female sales
4 Google 128 6.88 12 8 4410 6.1 178 449 27 Female Team leader

```

Expand All @@ -31,12 +31,12 @@ columns with targets probabilities using
>>> from xaiographs.datasets import load_phone_brand_preferences_discretized
>>> df_dataset, features_cols, target_cols, y_true, y_predict = load_phone_brand_preferences_discretized()
>>> df_dataset.head(5)
id internal memory performance main camera selfie camera battery size screen size weight price age gender occupation y_true y_predict Apple Google Motorola Samsung Xiaomi
0 0 128_GB Ultra top 15_50_MP <10_MP <4000_mAh <6.4_inches <190_g 450_700_dollars 35_45_years Female Technology Samsung Apple 1 0 0 0 0
1 1 >=256_GB Top <15_MP 10_30_MP <4000_mAh <6.4_inches 190_205_g >700_dollars 35_45_years Female Technology Apple Apple 1 0 0 0 0
2 2 128_GB Mid 15_50_MP <10_MP 4000_4700_mAh <6.4_inches >205_g 450_700_dollars 25_35_years Female Business Google Google 0 1 0 0 0
3 3 128_GB Mid 15_50_MP <10_MP 4000_4700_mAh 6.4_6.6_inches 190_205_g >700_dollars 25_35_years Female Business Samsung Samsung 0 0 0 1 0
4 4 128_GB Mid <15_MP <10_MP 4000_4700_mAh <6.4_inches <190_g 200_450_dollars 25_35_years Female Administration Google Google 0 1 0 0 0
id internal_memory performance main_camera selfie_camera battery_size screen_size weight price age gender occupation y_true y_predict Apple Google Motorola Samsung Xiaomi
0 0 128_GB Ultra top 15_50_MP <10_MP <4000_mAh <6.4_inches <190_g 450_700_dollars 35_45_years Female Technology Samsung Apple 1 0 0 0 0
1 1 >=256_GB Top <15_MP 10_30_MP <4000_mAh <6.4_inches 190_205_g >700_dollars 35_45_years Female Technology Apple Apple 1 0 0 0 0
2 2 128_GB Mid 15_50_MP <10_MP 4000_4700_mAh <6.4_inches >205_g 450_700_dollars 25_35_years Female Business Google Google 0 1 0 0 0
3 3 128_GB Mid 15_50_MP <10_MP 4000_4700_mAh 6.4_6.6_inches 190_205_g >700_dollars 25_35_years Female Business Samsung Samsung 0 0 0 1 0
4 4 128_GB Mid <15_MP <10_MP 4000_4700_mAh <6.4_inches <190_g 200_450_dollars 25_35_years Female Administration Google Google 0 1 0 0 0

```

Expand Down
4 changes: 2 additions & 2 deletions docs/source/user_guide/datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ The data was collected through a combination of three datasets containing the mo
| | |
|----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Source** | [https://www.kaggle.com/datasets/meirnizri/cellphones-recommendations/data?select=cellphones+ratings.csv](https://www.kaggle.com/datasets/meirnizri/cellphones-recommendations/data?select=cellphones+ratings.csv) |
| **Num Rows:** | 981 |
| **Num Features** | 17 |
| **Num Rows:** | 259 |
| **Num Features** | 11 |
| **Num Targets:** | 5 |
| **function to obtain dataset** | [`xaiographs.datasets.load_phone_brand_preferences()`](../api_reference/datasets.md#xaiographs.datasets.load_education_performance) |
| **function to obtain discretized dataset** | [`xaiographs.datasets.load_phone_brand_preferences_discretized()`](../api_reference/datasets.md#xaiographs.datasets.load_education_performance_discretized) |
Expand Down
4 changes: 4 additions & 0 deletions xaiographs/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@

from .datasets import load_compas_reality_discretized
from .datasets import load_compas_reality_why

from .datasets import load_phone_brand_preferences
from .datasets import load_phone_brand_preferences_discretized
from .datasets import load_phone_brand_preferences_why
Loading

0 comments on commit a8449de

Please sign in to comment.