Machine Learning tutorials from A to Z - part 3 - Technic Hubs

Technic Hubs

Technic Hubs aims in providing hands-on experience on Machine Learning, Augmented Reality(AR), Virtual Reality(VR), Django(Web Development), Flutter and React(App Development), Internet of Things(IoT) with videos on Nepali.

Breaking

Saturday, November 11, 2017

Machine Learning tutorials from A to Z - part 3

Yooo !! Whats up guys. From the machine learning tutorials A to Z upto part 2, you have downloaded the data set and imported library.  Now, its turn to move ahead and import the data sets. We have a file named data.csv which has data to be processed. We want to import that data. For this lets continue with the same data_preprocessing.py file.  To work with importing the data, we should set our working directory the same folder. You can see set directory option there. If you are in Spyder IDLE, you have to execute the previous line of commands initially. For more clarity better watch my video tutorial in YouTube.
Type the following code inside data_preprocessing.py:
                                                   dataset = pd.read_csv('Data.csv')
Execute this line by selecting this line, and see in the console aside. In order to import the data set, we make a dataset variable. We use pandas to import data. So, we used pd.read_csv('Data.csv'). If we go to variable explorer then we can see the dataset there. Then we will create a regression model. Now add these line of comments.
                              X = dataset.iloc[:,:-1].values       
                              y = dataset.iloc[:, 3].values
In our data set we have, 4 columns and 10 rows. dataset.iloc takes input as the number of rows and number of  columns. We take, 3 data values as X and other 1 as y. So, dataset.iloc[:(calls all rows), :-1(calls all columns expect one)].  Same in case of y. In y, 3 shows the last of the data value. Now, if you type X in console you will see, the first 3 data values.
If saying in 1 line, then dataset.iloc[] takes the rows and columns where:

        : means all set of data
        :-1 means all set of data expect last one
        3 means third set of data
PS: Please follow my YouTube videos for any problems.



















       




No comments:

Post a Comment