
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How can Tensorflow be used to display sample data from abalone dataset?
Once the abalone dataset has been downloaded using the google API, a few samples of the data can be displayed on the console using the ‘head’ method. If a number is passed to this method, that many rows would be displayed. It basically displays the rows from the beginning.
Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?
We will be using the abalone dataset, which contains a set of measurements of abalone. Abalone is a type of sea snail. The goal is to predict the age based on other measurements.
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.
print("Few samples of abalone data") abalone_train.head() print("The abalone dataset is copied to another memory location") abalone_features = abalone_train.copy() print("The age column is deleted") abalone_labels = abalone_features.pop('Age') abalone_features = np.array(abalone_features) print("The features are displayed") print(abalone_features)
Code credit: https://www.tensorflow.org/tutorials/load_data/csv
Output
Few samples of abalone data The abalone dataset is copied to another memory location The age column is deleted The features are displayed [[0.435 0.335 0.11 ... 0.136 0.077 0.097] [0.585 0.45 0.125 ... 0.354 0.207 0.225] [0.655 0.51 0.16 ... 0.396 0.282 0.37 ] ... [0.53 0.42 0.13 ... 0.374 0.167 0.249] [0.395 0.315 0.105 ... 0.118 0.091 0.119] [0.45 0.355 0.12 ... 0.115 0.067 0.16 ]]
Explanation
- A few samples of data is displayed on the console using the 'head' method.
- The dataset is coped to another memory location so that changes can be made to one of the dataset and still retain the originality of the dataset in the other memory location.
- We consider that the column 'Age' is irrelevant, hence it is deleted from the dataset.
- The features are displayed as vectors.
- Related Articles
- How can Tensorflow be used to load the csv data from abalone dataset?
- How can Tensorflow be used to display sample data from the cats and dogs input dataset?
- How can Tensorflow be used to iterate through the dataset and display sample data using Python?
- How can Tensorflow be used with abalone dataset to build a sequential model?
- How can Tensorflow be used to build a normalization layer for the abalone dataset?
- How can Tensorflow be used to visualize the augmented data from the dataset?
- How can Tensorflow be used to explore the dataset and see a sample file from the stackoverflow question dataset using Python?
- How can Tensorflow be used with Estimators to display metadata about the dataset?
- How can Tensorflow be used to standardize the flower dataset?
- How can Tensorflow be used to view a sample of the vectorised data using Python?
- How can Tensorflow be used to configure the dataset for performance?
- How can Tensorflow be used to create a dataset of raw strings from the Illiad dataset using Python?
- How can Tensorflow be used to load the Illiad dataset using Python?
- How can Tensorflow be used to train the Illiad dataset using Python?
- How can Tensorflow be used to define a model for MNIST dataset?
