load_coffee#

pyts.datasets.load_coffee(return_X_y: bool = False) → Bunch | tuple[NDArray[float64], NDArray[float64], NDArray[Any], NDArray[Any]][source]#

Load and return the Coffee dataset.

Food spectrographs are used in chemometrics to classify food types, a task that has obvious applications in food safety and quality assurance. The coffee data set is a two class problem to distinguish between Robusta and Aribica coffee beans.

Training samples

28

Test samples

28

Timestamps

286

Classes

2

Parameters:
return_X_ybool (default = False)

If True, return (data_train, data_test, target_train, target_test) instead of a Bunch object.

Returns:
dataBunch

Dictionary-like object, with attributes:

data_trainarray of floats

The time series in the training set.

data_testarray of floats

The time series in the test set.

target_trainarray of integers

The classification labels in the training set.

target_testarray of integers

The classification labels in the test set.

DESCRstr

The full description of the dataset.

urlstr

The url of the dataset.

(data_train, data_test, target_train, target_test)tuple if return_X_y is True

References

[1]

R. Briandet, E.K. Kemsley, and R.H. Wilson, “Discrimination of Arabica and Robusta in Instant Coffee by Fourier Transform Infrared Spectroscopy and Chemometrics”. Journal of Agricultural and Food Chemistry (1996).

[2]

A. Bagnall, L. Davis, J. Hills and J. Lines, “Transformation Based Ensembles for Time Series Classification”. SDM (2012).

Examples

>>> from pyts.datasets import load_coffee
>>> bunch = load_coffee()
>>> bunch.data_train.shape
(28, 286)
>>> X_train, X_test, y_train, y_test = load_coffee(return_X_y=True)
>>> X_train.shape
(28, 286)