--- dataset_info: features: - name: text dtype: string - name: label dtype: string splits: - name: train num_examples: 196629 num_bytes: 104709025 - name: validation num_examples: 28090 - name: test num_examples: 56181 configs: - config_name: default data_files: - split: train path: data/train.parquet - split: validation path: data/validation.parquet - split: test path: data/test.parquet task_categories: - text-classification license: cc-by-nc-4.0 --- Dataset adapted from [spawn99/wine-reviews](https://huggingface.co/datasets/spawn99/wine-reviews/blob/main/README.md) to train classifiers on grape variety. Columns were consolidated to match the format described in [this project](https://github.com/ivanfioravanti/wine_variety_classification/blob/main/data_utils.py) ``` import polars as pl from datasets import load_dataset ds_dict = load_dataset("spawn99/wine-reviews") processed_splits = {} for split_name, ds in ds_dict.items(): print(f"Processing {split_name} split...") # Convert to Polars (Zero-copy via Arrow) df = pl.from_arrow(ds.data.table) # Apply transformation logic df_final = df.select([ pl.format( "Based on this wine review, guess the grape variety:\n" "This wine is produced by {} in the {} region of {}.\n" "It was grown in {}. It is described as: \"{}\".\n" "The wine has been reviewed by {} and received {} points.\n" "The price is {}.", pl.col("winery").fill_null("a winery"), # Region logic: region_1 or province or region_2 or "Unknown region" pl.coalesce(["region_1", "province", "region_2"]).fill_null("Unknown region"), pl.col("country").fill_null("Unknown country"), pl.col("designation").fill_null("an unspecified appellation"), pl.col("description").fill_null("No description provided."), pl.col("taster_name").fill_null("a reviewer"), pl.col("points").cast(pl.String).fill_null("unrated"), # Price logic: cast to int to remove .0 then to string pl.col("price").cast(pl.Int64).cast(pl.String).fill_null("unknown") ).alias("text"), pl.col("variety").alias("label") ]).filter(pl.col("label").is_not_null()) processed_splits[split_name] = df_final # Save locally or inspect print(f"Split {split_name} finished. Rows: {len(df_final)}") df_final.write_parquet(f"processed/{split_name}.parquet") ``` # Original Dataset Details - **License:** [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) - **Attribution:** Zackthoutt - **Source:** [Wine Reviews Dataset on Kaggle](https://www.kaggle.com/datasets/zynicide/wine-reviews)