SlideShare a Scribd company logo
1 of 19
MACHINE LEARNING
What is Machine Learning?
the use and development of computer systems that are able to learn and
adapt without following explicit instructions, by using algorithms and statistical
models to analyze and draw inferences from patterns in data.
Is a science of making computers learn and act like humans by feeding data
and information without being explicitly programmed.
Real World Examples of Machine
Learning
Facial Recognitions Voice recognition
Ex: Siri & Cortana Healthcare Industry
Weather Forecasting Produce a web Series
7 Process of Machine Learning
Types of Machine Learning Algorithm
Popular Algorithms of Machine Learning
Sample Machine Learning Using Decision
Tress(Gathering Data)
Situation: Image we have an online music store
Note: In gender 1 for male & 0 for female
Codes for calling the data into the Jupyter
import pandas as pd
music_data = pd.read_csv('music.csv’)
music_data
Preparing the Data
Getting our output set
Learning & Predicting
sklearn library
Scikit-learn, often abbreviated as sklearn, is a popular Python library for
machine learning and data analysis. It provides a wide range of tools and
algorithms for various tasks related to machine learning and data mining.
Some of the key functions and features of scikit-learn include:
Data Preprocessing: Scikit-learn offers tools for data preprocessing, such as
data cleaning, scaling, encoding categorical variables, and feature selection.
This is essential for preparing data for machine learning models.
Supervised Learning: Scikit-learn supports a wide range of supervised
learning algorithms, including linear and logistic regression, support vector
machines, decision trees, random forests, k-nearest neighbors, and more.
These algorithms are used for tasks like classification and regression.
1.Unsupervised Learning: It also provides algorithms for unsupervised
learning, such as clustering (e.g., K-Means clustering) and dimensionality
reduction (e.g., Principal Component Analysis or PCA).
2.Model Selection: Scikit-learn includes tools for model selection and
hyperparameter tuning, like cross-validation, grid search, and randomized
search. These help in finding the best model and its associated
hyperparameters for a given problem.
3.Model Evaluation: You can use scikit-learn to evaluate the performance of
machine learning models through various metrics like accuracy, precision,
recall, F1-score, and ROC curves, among others.
4.Feature Extraction and Engineering: The library offers tools for feature
extraction and feature engineering, including techniques like TF-IDF, word
embeddings, and more.
Pipeline Building: Scikit-learn allows you to create machine learning
pipelines, which are sequences of data preprocessing steps, feature selection,
and model training. This helps streamline the machine learning workflow.
Ensemble Methods: You can build ensemble models like Random Forests
and Gradient Boosting using scikit-learn, which often improve predictive
performance.
Integration with NumPy and pandas: Scikit-learn integrates seamlessly with
other popular Python libraries like NumPy and pandas for data manipulation
and handling.
Community and Documentation: Scikit-learn has an active community of
users and developers, and it provides extensive documentation, tutorials, and
examples to help users get started with machine learning tasks.
We add in our library this code
from sklearn.tree import DecisionTreeClassifier
is a class in scikit-learn (sklearn) used to create
and train decision tree classifiers, which are a type
of supervised machine learning model. Decision
trees are used for both classification and
regression tasks.
How to use DecisionTreeClassifier
We need to initialize :
from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier()
Training: You can train the decision tree classifier on your dataset using the
fit() method. It takes the features (X) and target labels (y) as input:
model.fit(X, y)
Prediction:
predictions = model.predict(new_data) or in our case
predictions = model.predict([[21,1],[22,0]])
After training, you can use the trained model to make
predictions on new data points using the predict()
method:
Final Program
Training our Data
train_test_split- function from the sklearn.model_selection module in scikit-
learn is a commonly used function for splitting a dataset into two or more
subsets, typically for the purpose of training and testing a machine learning
model.
 Its primary function is to randomly divide a dataset into two or more
portions: one for training the model (the training set) and the other for
evaluating the model's performance (the testing/validation set).
sklearn.metrics - is a module in scikit-learn (a popular machine learning library
in Python) that provides a wide range of functions and classes for evaluating
the performance of machine learning models. These metrics are essential
for assessing how well your models are performing on various tasks, such
as classification, regression, clustering, and more
Final Program

More Related Content

Similar to Lecture-6-7.pptx

Introduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-LearnIntroduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-LearnBenjamin Bengfort
 
WELCOME TO AI PROJECT shidhant mittaal.pptx
WELCOME TO AI PROJECT shidhant mittaal.pptxWELCOME TO AI PROJECT shidhant mittaal.pptx
WELCOME TO AI PROJECT shidhant mittaal.pptx9D38SHIDHANTMITTAL
 
Machine learning for sensor Data Analytics
Machine learning for sensor Data AnalyticsMachine learning for sensor Data Analytics
Machine learning for sensor Data AnalyticsMATLABISRAEL
 
Machine Learning for .NET Developers - ADC21
Machine Learning for .NET Developers - ADC21Machine Learning for .NET Developers - ADC21
Machine Learning for .NET Developers - ADC21Gülden Bilgütay
 
Intersnship presentation done on inventeron technology company
Intersnship presentation done on inventeron technology companyIntersnship presentation done on inventeron technology company
Intersnship presentation done on inventeron technology companykushalk200220
 
Getting Started with Azure AutoML
Getting Started with Azure AutoMLGetting Started with Azure AutoML
Getting Started with Azure AutoMLVivek Raja P S
 
Data Science Task.pdf by the topper world
Data Science Task.pdf by the topper worldData Science Task.pdf by the topper world
Data Science Task.pdf by the topper worldTanishaChouhan4
 
Machine Tool And How You Can Work around It.pdf
Machine Tool And How You Can Work around It.pdfMachine Tool And How You Can Work around It.pdf
Machine Tool And How You Can Work around It.pdfLenore Industries
 
Artificial Intelligence Question Bank
Artificial Intelligence Question BankArtificial Intelligence Question Bank
Artificial Intelligence Question BankSpardhavijetha2DrKMs
 
data-science-pdf-16588.pdf
data-science-pdf-16588.pdfdata-science-pdf-16588.pdf
data-science-pdf-16588.pdfvkharish18
 
XL-MINER:Introduction To Xl Miner
XL-MINER:Introduction To Xl MinerXL-MINER:Introduction To Xl Miner
XL-MINER:Introduction To Xl Minerxlminer content
 
Self Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docxSelf Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docxShanmugasundaram M
 
Net campus2015 antimomusone
Net campus2015 antimomusoneNet campus2015 antimomusone
Net campus2015 antimomusoneDotNetCampus
 
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATAPREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATADotNetCampus
 
Intro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationIntro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationAnkit Gupta
 
Artificial Intelligence with Python | Edureka
Artificial Intelligence with Python | EdurekaArtificial Intelligence with Python | Edureka
Artificial Intelligence with Python | EdurekaEdureka!
 

Similar to Lecture-6-7.pptx (20)

Introduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-LearnIntroduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-Learn
 
WELCOME TO AI PROJECT shidhant mittaal.pptx
WELCOME TO AI PROJECT shidhant mittaal.pptxWELCOME TO AI PROJECT shidhant mittaal.pptx
WELCOME TO AI PROJECT shidhant mittaal.pptx
 
Machine learning for sensor Data Analytics
Machine learning for sensor Data AnalyticsMachine learning for sensor Data Analytics
Machine learning for sensor Data Analytics
 
Machine Learning for .NET Developers - ADC21
Machine Learning for .NET Developers - ADC21Machine Learning for .NET Developers - ADC21
Machine Learning for .NET Developers - ADC21
 
Intersnship presentation done on inventeron technology company
Intersnship presentation done on inventeron technology companyIntersnship presentation done on inventeron technology company
Intersnship presentation done on inventeron technology company
 
Machine Learning by Rj
Machine Learning by RjMachine Learning by Rj
Machine Learning by Rj
 
Getting Started with Azure AutoML
Getting Started with Azure AutoMLGetting Started with Azure AutoML
Getting Started with Azure AutoML
 
Data Science Task.pdf by the topper world
Data Science Task.pdf by the topper worldData Science Task.pdf by the topper world
Data Science Task.pdf by the topper world
 
Machine Tool And How You Can Work around It.pdf
Machine Tool And How You Can Work around It.pdfMachine Tool And How You Can Work around It.pdf
Machine Tool And How You Can Work around It.pdf
 
Artificial Intelligence Question Bank
Artificial Intelligence Question BankArtificial Intelligence Question Bank
Artificial Intelligence Question Bank
 
data-science-pdf-16588.pdf
data-science-pdf-16588.pdfdata-science-pdf-16588.pdf
data-science-pdf-16588.pdf
 
Introduction To XL-Miner
Introduction To XL-MinerIntroduction To XL-Miner
Introduction To XL-Miner
 
XL-MINER:Introduction To Xl Miner
XL-MINER:Introduction To Xl MinerXL-MINER:Introduction To Xl Miner
XL-MINER:Introduction To Xl Miner
 
Self Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docxSelf Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docx
 
Python and data analytics
Python and data analyticsPython and data analytics
Python and data analytics
 
Machine learning
 Machine learning Machine learning
Machine learning
 
Net campus2015 antimomusone
Net campus2015 antimomusoneNet campus2015 antimomusone
Net campus2015 antimomusone
 
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATAPREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
 
Intro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationIntro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning Presentation
 
Artificial Intelligence with Python | Edureka
Artificial Intelligence with Python | EdurekaArtificial Intelligence with Python | Edureka
Artificial Intelligence with Python | Edureka
 

More from JohnMichaelPadernill (9)

SearchAlgorithm.pdf
SearchAlgorithm.pdfSearchAlgorithm.pdf
SearchAlgorithm.pdf
 
Lecture3.pptx
Lecture3.pptxLecture3.pptx
Lecture3.pptx
 
Lecture5.pptx
Lecture5.pptxLecture5.pptx
Lecture5.pptx
 
maze runner game.pptx
maze runner game.pptxmaze runner game.pptx
maze runner game.pptx
 
Lesson 2 The Maze Runner.pptx
Lesson 2 The Maze Runner.pptxLesson 2 The Maze Runner.pptx
Lesson 2 The Maze Runner.pptx
 
Lesson-1-Hack-Attack.pptx
Lesson-1-Hack-Attack.pptxLesson-1-Hack-Attack.pptx
Lesson-1-Hack-Attack.pptx
 
Lesson-6-Fruit-Slicer.pptx
Lesson-6-Fruit-Slicer.pptxLesson-6-Fruit-Slicer.pptx
Lesson-6-Fruit-Slicer.pptx
 
Lesson-7-Flappy-Bird.pptx
Lesson-7-Flappy-Bird.pptxLesson-7-Flappy-Bird.pptx
Lesson-7-Flappy-Bird.pptx
 
Lesson-8-Asteroid.pptx
Lesson-8-Asteroid.pptxLesson-8-Asteroid.pptx
Lesson-8-Asteroid.pptx
 

Recently uploaded

Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 

Recently uploaded (20)

Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 

Lecture-6-7.pptx

  • 2. What is Machine Learning? the use and development of computer systems that are able to learn and adapt without following explicit instructions, by using algorithms and statistical models to analyze and draw inferences from patterns in data. Is a science of making computers learn and act like humans by feeding data and information without being explicitly programmed.
  • 3. Real World Examples of Machine Learning Facial Recognitions Voice recognition Ex: Siri & Cortana Healthcare Industry Weather Forecasting Produce a web Series
  • 4. 7 Process of Machine Learning
  • 5. Types of Machine Learning Algorithm
  • 6. Popular Algorithms of Machine Learning
  • 7. Sample Machine Learning Using Decision Tress(Gathering Data) Situation: Image we have an online music store Note: In gender 1 for male & 0 for female
  • 8. Codes for calling the data into the Jupyter import pandas as pd music_data = pd.read_csv('music.csv’) music_data Preparing the Data
  • 11. sklearn library Scikit-learn, often abbreviated as sklearn, is a popular Python library for machine learning and data analysis. It provides a wide range of tools and algorithms for various tasks related to machine learning and data mining. Some of the key functions and features of scikit-learn include: Data Preprocessing: Scikit-learn offers tools for data preprocessing, such as data cleaning, scaling, encoding categorical variables, and feature selection. This is essential for preparing data for machine learning models. Supervised Learning: Scikit-learn supports a wide range of supervised learning algorithms, including linear and logistic regression, support vector machines, decision trees, random forests, k-nearest neighbors, and more. These algorithms are used for tasks like classification and regression.
  • 12. 1.Unsupervised Learning: It also provides algorithms for unsupervised learning, such as clustering (e.g., K-Means clustering) and dimensionality reduction (e.g., Principal Component Analysis or PCA). 2.Model Selection: Scikit-learn includes tools for model selection and hyperparameter tuning, like cross-validation, grid search, and randomized search. These help in finding the best model and its associated hyperparameters for a given problem. 3.Model Evaluation: You can use scikit-learn to evaluate the performance of machine learning models through various metrics like accuracy, precision, recall, F1-score, and ROC curves, among others. 4.Feature Extraction and Engineering: The library offers tools for feature extraction and feature engineering, including techniques like TF-IDF, word embeddings, and more.
  • 13. Pipeline Building: Scikit-learn allows you to create machine learning pipelines, which are sequences of data preprocessing steps, feature selection, and model training. This helps streamline the machine learning workflow. Ensemble Methods: You can build ensemble models like Random Forests and Gradient Boosting using scikit-learn, which often improve predictive performance. Integration with NumPy and pandas: Scikit-learn integrates seamlessly with other popular Python libraries like NumPy and pandas for data manipulation and handling. Community and Documentation: Scikit-learn has an active community of users and developers, and it provides extensive documentation, tutorials, and examples to help users get started with machine learning tasks.
  • 14. We add in our library this code from sklearn.tree import DecisionTreeClassifier is a class in scikit-learn (sklearn) used to create and train decision tree classifiers, which are a type of supervised machine learning model. Decision trees are used for both classification and regression tasks.
  • 15. How to use DecisionTreeClassifier We need to initialize : from sklearn.tree import DecisionTreeClassifier model = DecisionTreeClassifier() Training: You can train the decision tree classifier on your dataset using the fit() method. It takes the features (X) and target labels (y) as input: model.fit(X, y)
  • 16. Prediction: predictions = model.predict(new_data) or in our case predictions = model.predict([[21,1],[22,0]]) After training, you can use the trained model to make predictions on new data points using the predict() method:
  • 18. Training our Data train_test_split- function from the sklearn.model_selection module in scikit- learn is a commonly used function for splitting a dataset into two or more subsets, typically for the purpose of training and testing a machine learning model.  Its primary function is to randomly divide a dataset into two or more portions: one for training the model (the training set) and the other for evaluating the model's performance (the testing/validation set). sklearn.metrics - is a module in scikit-learn (a popular machine learning library in Python) that provides a wide range of functions and classes for evaluating the performance of machine learning models. These metrics are essential for assessing how well your models are performing on various tasks, such as classification, regression, clustering, and more

Editor's Notes

  1. In this data set there is no null value or duplicate but we need to separate the columns ,the two columns is the input set and the other is the output sets. We need to separate the columns because we need to train a model in our case the output set is the genre which consider to be our predictions. If you try to observe in in table we don’t have a data containing 21yrs old male, we don’t know what would the prefer genre they like, so we will ask our model make some predictions .
  2. Overall, scikit-learn is a powerful and versatile library that simplifies many aspects of machine learning in Python, making it accessible to both beginners and experienced data scientists and machine learning practitioners.
  3. Rule of the thumb, allocate 70-80 %of our data for training and 20-30% for its testing.