Machine Learning #3 – Simple Test Using Tree Decision
Articles,  Blog

Machine Learning #3 – Simple Test Using Tree Decision


to be able to master a science, learning is the key. especially in the IT field but for certain cases, reading alone is not enough. But you have to practice too so you can understand. and in this case we will try the existing machine learning platform the goal is that we can understand first with the example of this existing framework in this video, we will try scikit-learn for the link in the description according to the data we have classified in the previous video we already have 4 features and labels For its features, it consists of IP Address, URL address requested, Useragent, and respond to the code. If we implement this data into codes it will be like this In feature variables, there are values that we have taken from logs While on the label variable, each index represents the status of the request from each index array in the features the feature will be labeled OK, if the request made by the user is normal and NOT OK if the request made by the user is suspicious Because the value calculated by this bit is in the form of numbers so we change each value from the feature array to a number For the IP Adress key in the array, we will only give values 0 and 1 Zero, if the IP of the user making the request is not listed in the blacklist and One, if the IP of the user making the request is included in the blacklist In this case, this is because we only analyze local logs so we assume that all IP values are 0 That is, IPs that are not included in the blacklist Then in the part of the requested URL address we will only give values of 0 and 1 * sound of a rooster crowing * what a rooster -_- Zero, if the requested URL is not included in the whitelist and 1 if the requested link is the permitted links For the discussion on how to make this URL whitelist I have discussed in the previous video with the title “Creating a Web Crawler From Scratch” the link can be seen in the description. In the “useragent” key, we will specify the code manually For example number 1 for Firefox, 2 for Chrome, 3 for Opera, and 4 for UserAgent besides that. And finally the key “response code” because the value is already in the form of numbers, so we don’t need to change it. After classification and simplification of data is complete next we will include scikit-learn to training the new data using Tree Decision method For documentation can be read directly on the scikit-learn website link in the description this is the declaration of the method we use and this is the training process then we will detect whether the request from the user is OK or NOT OK we use predict as example, the IP Address is in the whitelist the URL is in whitelist too using Firefox browser and respond code 200 this an example of Normal Request now we run this simple test we managed to get the OK output now we try the opposite useragent is curl, so it’s code is 4 (else) the requested URL is not in the whitelist respond code 404 now run NOT OK last we tried to combine OK and NOT OK conditions the IP is still as whitelist requested URL is not in the whitelist using Firefox and respond code 200 now run for accurate results depends on trained data so, what do you think guys? easy isn’t it? [email protected]^#[email protected]#! If you are still curious or for those of you who want to share about machine learning please directly join in the telegram group the link is available in the description see you in the next video ciaoo

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *