Professional Documents
Culture Documents
Ia TP2 PDF
Ia TP2 PDF
Exercice 1 :
. Step 1 :
. Step 2 :
● Sklearn a machine learning library , it provides a range of
algorithms for tasks such as classification , regression , clustering ,
It also tools for working with data such as loading and
transforming data. It also includes a range of tools for working with
different data types such as text and image data .
❖ sklearn.tree its a library that contains classes and function related
to decision tree algorithms
❖ DecisionTreeClassifier a class used for classification tasks and
creates a decision tree models
❖ export_graphviz a function can be used to export a decision tree
model in graphviz format ( graphviz is a software that can be used
to create diagrams and graphs ) it takes as input a decision tree
model and other parameters .
❖ sklearn.model_selection it’s a module that provides tools for model
selection and evaluation ( the process of choosing the best
machine learning algorithm for a given task
❖ train_test_split a function used to split a dataset into two subsets a
training set and a testing set to evaluate the performance of a
machine learning model by training the model and then testing the
model
.Step2:
input 9 ⇒ we drops the Kyphosis column from d
.Step3:
input 12 => x_train and y_train will contain the training ata
y_train and x_train will contain the testing data
test_size =0.3 means that the testing set will contain 30%
of the data and 70% will be used for the training
.Step4:
Input 8 ⇒ selecting all rows and the first four columns using the iloc
method in pandas used to select rows and columns by their numerical
index the first specifies the rows and the second specifies the columns
Input 9 ⇒ selecting all rows and the last column