Skip to main content

Machine Learning : Decision Tree - machinelearningtechnilesh

 Machine Learning : Part 3 : Decision Tree 



We were learn all the stuff regrading the Machine learning . 
For Video Lecture on Machine Learning : Decision Go at bottom or google codewithnilesh.

Actually The decision Tress is normal Tree data Structure . we they having Root  , Leaf  and Internal . You get all idea of Decision Tree By just Viewing below image . 

Image made By Garry Raut : 



As You Get Idea from This Figure that Decision tree is actually a tree Data Structure .Where if The value is true then go toward the yes i.e. Right Tree .When the condition false or the value is not stratified then go Toward the Left tree.

The Equation for Decision tree is :


Entropy = Î£ - p * log(p)


Now we are making model for Prediction of salaries .

Step 1 : Data Preprocessing :

Initially Import all Libraries like Pandas , numpy , matlibplot pyplot & Sklearn
using the pandas take data and classify in to dependent and independent variable.

Code : Garry Raut ( Machine learner ) 

import numpy as np 
import pandas as pd
import matplotlib.pyplot as plt

dataset = pd.read_csv('position_salaries.csv')
X = dataset.iloc[: , 1:2].values
Y = dataset.iloc[: ,2].values

The data in Position Salaries file is :
Position                                            Level                                 Salary
BusinessAnalyst                               1                                        45232
JuniorConsultant                              2                                        52300
Senior Consultant                            3                                        62300
Manager                                         4                                        84300
Country Manager                             5                                       110540
Region Manager                               6                                       160000
Partner                                           7                                        250000
Senior Partner                                 8                                        341231
C-level                                            9                                        670000
CEO                                               10                                       3000000


Step :2 : Decision tree regressor 

Firstly import the Decision tree regressor class from Sklearn libraries of sub libraries Tree ( Sklearn.tree ) . The class which we import from this libraries is DecisionTreeRegressor . TO access the class the create the regressor object which access the class . now fit the data in regressor object using the fit inbuilt method of machine learning .

Code : Garry Raut ( Machine learner ) 

from sklearn.tree import DecisionTreeRegressor
regressor= DecisionTreeRegressor(random_state=0)
regressor.fit(X ,Y)




Step 3 : Visualiztion of the data in Graphical view 

To View data in Graphical manner we used the Matlibplot librarie.

Code : Garry Raut ( Machine learner ) 

def desion():
    X_grid = np.arange(min(X), max(X), 0.1)
    X_grid = X_grid.reshape((len(X_grid), 1))
    plt.scatter(X, Y, color = 'green')
    plt.plot(X_grid, regressor.predict(X_grid), color = 'blue')
    plt.title('Truth or Bluff (Support Vector Regression Model)CodewithNilesh')
    plt.xlabel('Position levelCodewithNilesh')
    plt.ylabel('SalaryCodewithNilesh')
    plt.show()
desion()

We call the method and Show the graphs ou see the below results :



Bookmark This Site for more Update and Share to your friend and many more .....

For Video Lecture on Machine Learning : Decision Tree here






machine learning decision tree example?,machine learning decision tree algorithm?.machine learning decision tree python?,machine learning decision tree example python?,machine learning decision tree regression?,machine learning decision tree ppt?,machine learning decision tree entropy?machine learning decision tree in matlab?,machine learning decision tree?,machine learning decision tree example?,machine learning decision tree algorithm?,machine learning decision tree python?,machine learning decision tree example python?,machine learning decision tree regression?,machine learning decision tree ppt?,




<!

Comments

Popular posts from this blog

what gaming development require ,how the game developed ? -machinelearningtechnilesh

  What is gaming development & requirement? how the game developed? Hellos guys today we are exploring the video gaming industry and how the game is developed by the gaming engineers. The video gaming industry is growing exponentially on a large scale. A large no of games is launched by the many video gaming companies games like GTA 5 ( All series 1,2,3,4,5) by Rockstar studio & Cricket (2007,2010) by EA sports.The game development is also a big future for engineers. Today we are exploring the path to develop the game and which programming language is required and which skill do have to become a gaming developer.  Table Of Contents C# (C Sharp ) The best language for game development is c#. This language is similar to java and c,c++ programming. The Language is best because it used in AR & VR and ios development also. The best part of this programming language is the OOP (object-oriented programming) .this language works on .NET Frameworks. To build a game or AR ...

Sentiment Analysis using NLP Libraries -machinelearningtechnilesh

Doing Sentiment Analysis using NLP Libraries Conclusion from the Frist Approach : Sentiment Analysis using NLP Libraries (Unsupervised learning ) : result and analysis:  1) AFINN lexicon Model Performance metrics: ------------------------------ Accuracy: 0.71 Precision: 0.73 Recall: 0.71 F1 Score: 0.71 The Accuracy is 71% and F1 score tell about the performance of the that is 72%.that getting success is 72%. 2) SentiWordnet Model Performance metrics: ------------------------------ Accuracy: 0.69 Precision: 0.69 Recall: 0.69 F1 Score: 0.68 The Accuracy is 71% and F1 score tell about the performance of the that is 72%.that getting success is 72%. 3) VADER Model Performance metrics: ------------------------------ Accuracy: 0.71 Precision: 0.72 Recall: 0.71 F1 Score: 0.71 The Accuracy is 71% and F1 score tell about the performance of the that is 72%.that getting success is 72%. From comparing all three unsupervised model the AFFIN is best model because the precise value is greater than...

Computer Networks All Basic in one Blog :machinelearningtechnilesh

 . A computer network is formed by two or more devices connected together, these devices might be connected to share data to do some computations together or to share the resources. For example, a simple network where two computers are connected and one printer is connected and these both computers want to give command to the printer. So Resource Sharing is happening Do you do computer networks, computer networks are in fact everywhere they are in our office, they are in our home. In home, we might have multiple devices like laptops, Alexa, or other devices which are connected in a network. in office, you often see networks, your computers connected through a switch or any other device like router, and they form a network. So there are many, many networks that exist. In this course, we are going to focus mainly on internet, the largest network, almost half of the world's population is connected to the internet. In fact, most of our home devices, our office devices, they are connect...