- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How can Tensorflow be used with estimators to visualize the titanic data?

The titanic dataset can be visualized using the ‘hist’ method which visualizes a histogram. A horizontal bar graph can be generated by specifying the type of graph as ‘barh’.

**Read More:**
What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?

We will use the Keras Sequential API, which is helpful in building a sequential model that is used to work with a plain stack of layers, where every layer has exactly one input tensor and one output tensor.

TensorFlow Text contains collection of text related classes and ops that can be used with TensorFlow 2.0. The TensorFlow Text can be used to preprocess sequence modelling.

We are using the Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code over the browser and requires zero configuration and free access to GPUs (Graphical Processing Units). Colaboratory has been built on top of Jupyter Notebook.

An Estimator is TensorFlow's high-level representation of a complete model. It is designed for easy scaling and asynchronous training. We will train a logistic regression model using the tf.estimator API. The model is used as a baseline for other algorithms. We use the titanic dataset with the goal of predicting passenger survival, given characteristics such as gender, age, class, etc.

## Example

print("Visualizing the data") print(dftrain.age.hist(bins=20)) print(dftrain.sex.value_counts().plot(kind='barh')) print(dftrain['class'].value_counts().plot(kind='barh')) pd.concat([dftrain, y_train], axis=1).groupby('sex').survived.mean().plot(kind='barh').set_xlabel('% survive')

Code credit −https://www.tensorflow.org/tutorials/estimator/linear

## Output

Visualizing the data

## Explanation

- The various feature columns of the titanic dataset are visualized.
- They are plotted using the ‘plot’ method.

- Related Questions & Answers
- How can Tensorflow be used with Estimators to explore the titanic data?
- How can Tensorflow be used with Estimators to visualize the data, and the ROC curve?
- How can Tensorflow be used with Estimators to inspect the titanic dataset using Python?
- How can Tensorflow be used with Estimators to train the model for titanic dataset?
- How can Tensorflow be used with Estimators to add a column to the titanic dataset?
- How can Tensorflow be used with Estimators to perform data transformation?
- How can Tensorflow be used with Estimators to inspect a specific column of titanic dataset?
- How can Tensorflow and Estimators be used to predict the output of the titanic dataset?
- How can Tensorflow be used to visualize the data using Python?
- How can Tensorflow be used with Estimators to optimize the model?
- How can Tensorflow be used to visualize the augmented data from the dataset?
- How can Tensorflow be used with Estimators to split the iris dataset?
- How can Tensorflow be used with Estimators to define a function that shuffles data?
- How can Tensorflow be used with Estimators for feature engineering the model?
- How can Tensorflow be used with Estimators to evaluate the model using Python?