Do this with R and please give the answer as well.
Homework 11
Q1. [1 pt.] (submit to this assignment item) Consider a decision tree model for classification of a binary categorical variable Y that has two classes (A and B), and the decision rule at the root node was chosen based on the values of X3 given a dataset of 100 observations (40 and 60 observations for classes A and B, respectively) as follows
Class A: 40 Class B: 60
X3=M Y N
Class A: 30 Class B: 10
Class A: 10 Class B: 50
When the number of observations for each class of Y is given as shown in the figure above, what
is the Gini impurity index after this first split?