Skip to main content

data

Usage

Example datasets bundled with mlfeatures.

Each name below is a dataset, loaded on access as a polars DataFrame::

from mlfeatures.data import credit

credit.head()

The files ship inside the package, so a cell copied out of the documentation runs anywhere mlfeatures is installed. They add about 2 MB to the installed package, most of it beans. Every access reads the parquet file afresh; bind the result to a name rather than reaching for the attribute repeatedly. pandas users can call .to_pandas() on the result.

The four R-exported datasets (ames, beans, concrete, credit) were written from R with arrow::write_parquet in the mlfeatures research repo. ames_mini and hotels are derived here by the private _regenerate_* functions at the bottom of this module.

Attributes

Name Description
ames Ames, Iowa housing sales: 2,930 sales x 74 columns.
ames_mini A teaching subset of ames: 2,930 sales x 11 columns.
beans Dry beans: 13,611 beans x 17 columns.
concrete Concrete mixtures: 1,030 mixtures x 9 columns.
credit Credit applications: 4,454 applications x 14 columns.
hotels Hotel bookings: 50,000 stays x 23 columns.

ames

Ames, Iowa housing sales: 2,930 sales x 74 columns.

ames: pl.DataFrame

Target: Sale_Price. Every property sold in Ames between 2006 and 2010, with 73 columns describing the lot, the building, the sale, and the location (Latitude, Longitude). Mixed numeric and string columns, no missing values, many near-zero-variance and rare-level columns; the workhorse regression example in Tidy Modeling with R.

Source: R modeldata::ames (De Cock, 2011), https://modeldata.tidymodels.org/reference/ames.html


ames_mini

A teaching subset of ames: 2,930 sales x 11 columns.

ames_mini: pl.DataFrame

Target: Sale_Price. The columns Tidy Modeling with R uses in its Ames recipes (Neighborhood, Bldg_Type, Gr_Liv_Area, Year_Built, Latitude, Longitude) plus four chosen to show common preprocessing problems in one screen: Street is near-zero variance (12 of 2,930 rows are "Grvl"), Garage_Cars and Garage_Area are highly correlated, Neighborhood has 7 levels under 1% of rows, and Exterior_1st has a level rare enough to land only in a test split. Values are untransformed; Sale_Price is in dollars.

Source: derived from ames; see _regenerate_ames_mini.


beans

Dry beans: 13,611 beans x 17 columns.

beans: pl.DataFrame

Target: class (7 varieties). 16 numeric shape measurements from images of each bean, heavily correlated with one another; the dimensionality reduction example in Tidy Modeling with R, ch. 16.

Source: Koklu & Ozkan (2020) via the R beans package, https://cran.r-project.org/package=beans


concrete

Concrete mixtures: 1,030 mixtures x 9 columns.

concrete: pl.DataFrame

Target: compressive_strength. 7 ingredient amounts plus age, all numeric and complete; the workflow-sets example in Tidy Modeling with R, ch. 15.

Source: R modeldata::concrete (Yeh, 1998), https://modeldata.tidymodels.org/reference/concrete.html


credit

Credit applications: 4,454 applications x 14 columns.

credit: pl.DataFrame

Target: Status ("good"/"bad"). 9 numeric and 4 string features with missing values in both (Income has 381 nulls, Assets and Debt a few dozen each, and Home, Marital, and Job a handful each), so it exercises imputation and missing-level handling before encoding. Note Home already has a level named "other".

Source: R modeldata::credit_data, https://modeldata.tidymodels.org/reference/credit_data.html


hotels

Hotel bookings: 50,000 stays x 23 columns.

hotels: pl.DataFrame

Target: children ("children"/"none", about 8% with children). Booking details for two Portuguese hotels: lead time, nights, meal plan, country (155 levels), market segment, room types, deposit type, daily rate, and an arrival_date column of dtype Date. No missing values. The tidymodels “predictive modeling case study” data, so it is the natural home for date, holiday, and rare-level steps.

Source: https://tidymodels.org/start/case-study/ (Antonio, Almeida & Nunes, 2019, “Hotel booking demand datasets”, Data in Brief).