In [10]: N import pandas as pd import numpy as np from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split, GridSearchCV from sklearn import metrics...


In this piece of code, the output of clf is DecisionTreeClassifier(). Why is the inside of the () empty? The output should be as same as the image(2) showed.


In [10]: N import pandas as pd<br>import numpy as np<br>from sklearn.tree import DecisionTreeClassifier<br>from sklearn.model_selection import train_test_split, GridSearchCV<br>from sklearn import metrics<br>np.random.seed (66)<br># Load dataset and preprocessing<br>churn = pd.read_csv('https://raw.githubusercontent.com/yhat/demo-churn-pred/master/model/churn.csv')<br>churn.columns<br>churn[

Extracted text: In [10]: N import pandas as pd import numpy as np from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split, GridSearchCV from sklearn import metrics np.random.seed (66) # Load dataset and preprocessing churn = pd.read_csv('https://raw.githubusercontent.com/yhat/demo-churn-pred/master/model/churn.csv') churn.columns churn["Int'l Plan"] churn[ 'VMail Plan'] = churn['VMail Plan'].replace({"yes": 1, "no": 0}) churn.select_dtypes('object').columns churn.drop(['State', 'Phone'], inplace=True, axis=1) # sklearn expects all numerical attributes churn["Int'1 Plan"].map(dict(yes=1, no=0)) In [12]: N # Model Training X = churn.drop('Churn?', axis=1) y = churn[' Churn?'] X_train, X_test, y_train, y_test = print (f"train data size is {X_train.shape}") train_test_split(X, y, test_size=0.3, random_state=1) clf = DecisionTreeClassifier() clf train data size is (2333, 18) Out[12]: DecisionTreeClassifier()
Out[46]: DecisionTreeClassifier(ccp_alpha=0.0, class_weight=None, criterion='gini',<br>max_depth=None, max_features=None, max_leaf_nodes=None,<br>min_impurity_decrease=0.0, min_impurity_split=None,<br>min_samples_1leaf=1, min_samples_split=2,<br>min_weight_fraction_leaf=0.0, presort='deprecated',<br>random_state=None, splitter='best')<br>

Extracted text: Out[46]: DecisionTreeClassifier(ccp_alpha=0.0, class_weight=None, criterion='gini', max_depth=None, max_features=None, max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_1leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, presort='deprecated', random_state=None, splitter='best')

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here