Now we have imported our data so next step is to see what is our data made of. Before that let me give you a brief explanation about what are Features and Labels.
Features : Any Value in our data which is used/helpful in making predictions or any values in our data based on we can make good predictions are know as features. There can be one or many features in our data. They are usually represented by ‘x’.
Labels : Values which are to predicted are called Labels or Target values. These are usually represented by ‘y’.
Getting to know your Data
Before staring to write any code you should know what your aim/result. To know what your data is made of we will use some commands. let’s start
We can use Data_Frame.head() command to see some top rows and columns of our data.

We can also use Data_Frame.tail() command to see some bottom rows and columns of our data. Data_Frame.describe() shows some useful stats about our data.


Deciding our Features and Labels
Here I am going to use only one Feature which is total_rooms and our label which we are going to predict will be median_house_value. Now lets define our features and labels.
In order to import our training data into TensorFlow, we need to specify what type of data each feature contains. There are two main types of data we’ll use in this and future exercises: Categorical Data and Numeric Data
In TensorFlow, we indicate a feature’s data type using a construct called a feature column. Feature columns store only a description of the feature data; they do not contain the feature data itself.
To start, we’re going to use just one numeric input feature, total_rooms. The following code pulls the total_rooms data from our Data_Frame and defines the feature column using numeric_column, which specifies its data is numeric.(when using more than one feature use a comma to separate different features)

Defining Labels
>>targets = Data_Frame[“median_house_value”] Now we have also defined our Labels.

In the next post we will start writing our LinearRegressor model. Note that i have changed the data, it’s not the same data which I used in my previous blog.
Links
Link for the data : https://download.mlcc.google.com/mledu-datasets/california_housing_train.csv
Link for my previous Blog Importing Data for ML : https://machinelearningpower.home.blog/2019/03/30/importing-data-ml/

One thought on “Our Data with TensorFlow (ML)”