<br />

- **Description**:

Dataset describing the survival status of individual passengers on the Titanic.
Missing values in the original dataset are represented using ?. Float and int
missing values are replaced with -1, string missing values are replaced with
'Unknown'.

- **Homepage** :
  <https://www.openml.org/d/40945>

- **Source code** :
  [`tfds.datasets.titanic.Builder`](https://github.com/tensorflow/datasets/tree/master/tensorflow_datasets/datasets/titanic/titanic_dataset_builder.py)

- **Versions**:

  - `2.0.0`: New split API (<https://tensorflow.org/datasets/splits>)
  - `3.0.0`: Use a standard flat dictionary of features for the dataset. Use `as_supervised=True` to split the dataset into a `(features_dict, survived)` tuple.
  - **`4.0.0`** (default): Fix inverted labels which were inverted in the 3.0.0.
- **Download size** : `114.98 KiB`

- **Dataset size** : `382.58 KiB`

- **Auto-cached**
  ([documentation](https://www.tensorflow.org/datasets/performances#auto-caching)):
  Yes

- **Splits**:

| Split | Examples |
|---|---|
| `'train'` | 1,309 |

- **Feature structure**:

    FeaturesDict({
        'age': float32,
        'boat': string,
        'body': int32,
        'cabin': string,
        'embarked': ClassLabel(shape=(), dtype=int64, num_classes=4),
        'fare': float32,
        'home.dest': string,
        'name': string,
        'parch': int32,
        'pclass': ClassLabel(shape=(), dtype=int64, num_classes=3),
        'sex': ClassLabel(shape=(), dtype=int64, num_classes=2),
        'sibsp': int32,
        'survived': ClassLabel(shape=(), dtype=int64, num_classes=2),
        'ticket': string,
    })

- **Feature documentation**:

| Feature | Class | Shape | Dtype | Description |
|---|---|---|---|---|
|   | FeaturesDict |   |   |   |
| age | Tensor |   | float32 |   |
| boat | Tensor |   | string |   |
| body | Tensor |   | int32 |   |
| cabin | Tensor |   | string |   |
| embarked | ClassLabel |   | int64 |   |
| fare | Tensor |   | float32 |   |
| home.dest | Tensor |   | string |   |
| name | Tensor |   | string |   |
| parch | Tensor |   | int32 |   |
| pclass | ClassLabel |   | int64 |   |
| sex | ClassLabel |   | int64 |   |
| sibsp | Tensor |   | int32 |   |
| survived | ClassLabel |   | int64 |   |
| ticket | Tensor |   | string |   |

- **Supervised keys** (See
  [`as_supervised` doc](https://www.tensorflow.org/datasets/api_docs/python/tfds/load#args)):
  `({'age': 'age', 'boat': 'boat', 'body': 'body', 'cabin': 'cabin',
  'embarked': 'embarked', 'fare': 'fare', 'home.dest': 'home.dest', 'name':
  'name', 'parch': 'parch', 'pclass': 'pclass', 'sex': 'sex', 'sibsp':
  'sibsp', 'ticket': 'ticket'}, 'survived')`

- **Figure**
  ([tfds.show_examples](https://www.tensorflow.org/datasets/api_docs/python/tfds/visualization/show_examples)):
  Not supported.

- **Examples**
  ([tfds.as_dataframe](https://www.tensorflow.org/datasets/api_docs/python/tfds/as_dataframe)):

<iframe src="https:///frame/datasets/catalog/titanic_076b6eab35983b4846ca59f3f47ac133e32f911e3093dc76e19082ede55103f1.frame" class="framebox inherit-locale " allow="clipboard-write https://" allowfullscreen is-upgraded></iframe>

- **Citation**:

    @ONLINE {titanic,
    author = "Frank E. Harrell Jr., Thomas Cason",
    title  = "Titanic dataset",
    month  = "oct",
    year   = "2017",
    url    = "https://www.openml.org/d/40945"
    }