Making a dataset

Like in Chapter 10Making a Guard Robot, we have used multiple images for the user to train the model to find out whether the object in the image is a man or something else. In a very similar way, we would have to make a dummy dataset so that the machine learning algorithm can predict based on that data what should be done. 

To make a dataset, we need to understand what data is being considered. In this chapter, we will be making a machine learning algorithm based on time and the temperature to predict whether the fan should be on or off. Hence, there are at least two things that should be provided by us to the system one being Temperature, and the other would be Time so that the prediction can take place. But one thing to remember is that we are talking about a supervised learning algorithm, so to train the model, we need to also give the outcome of Temperature and Time onto the state of the fan. Here, the state of the fan would be either on or off. Hence, we can depict it using 0 or 1. Now let's go ahead and make a dataset by ourselves. 

Now, to make a dataset, you simply have to open Microsoft Excel and start writing the dataset as follows:

It is always better to have a dataset of more than 20 sets of data. Also, its important that the data has a distinct characteristic and its not random data. For example, in the preceding case, you can see that at 12.44 when the temperature is 28, the fan will be on; however, at the same time, when the time is 12.13 and temperature is 21, then the fan is off. 

Once you have created a dataset, then you must save it with the name dataset in the CSV format. There may be some users who would not use a Microsoft Excel, in which case you can write the data with the same format in text editor and finally save it in the CSV format. 

Once you have the dataset.csv files, then you must go ahead and copy them into the place where you will be saving the upcoming code. Once you are done, then we can move on to the next step. 

Remember that the better the quality of data, the better the learning process. So you may take some time and carefully craft your dataset so that it does make sense. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.133.96