title: Training a decision tree using id3 algorithm by sklearn
body: <p>I am trying to train a decision tree using the id3 algorithm.
  The purpose is to get the indexes of the chosen features, to esimate the occurancy, and to build a total confusion matrix.</p>
  
  <p>The algorithm should split the dataset to training set, and a test set, and use cross validation with 4 folds.</p>
  
  <p>I am new to the subject, I've read the tutorials on sklearn and theory about learning process, but I'm still very confused.</p>
  
  <p>What I've tried doing:</p>
  
  <pre><code>from sklearn.model_selection import cross_val_predict,KFold,cross_val_score, 
  train_test_split, learning_curve
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.metrics import confusion_matrix
  
  
  X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=1)
  clf = DecisionTreeClassifier(criterion='entropy', random_state=0)
  clf.fit(X_train,y_train)
  results = cross_val_score(estimator=clf, X=X_train, y=y_train, cv=4)
  print("Accuracy: %0.2f (+/- %0.2f)" % (results.mean(), results.std()))
  y_pred = cross_val_predict(estimator=clf, X=x, y=y, cv=4)
  conf_mat = confusion_matrix(y,y_pred)
  print(conf_mat)
  dot_data = tree.export_graphviz(clf, out_file='tree.dot') 
  </code></pre>
  
  <p>I have some questions:</p>
  
  <ol>
  <li><p>How can I get a list of the feature indexes used in the training? Do I have to go through the tree in clf? Couldn't find any api method to retrieve them.</p></li>
  <li><p>Do I have to use 'fit', 'cross_val_score', and 'cross_val_predict'? It seems that all of them do some kind of learning process, but I could't manage to get the clf fitted, the accurancy and the confusuin matrix from one of them only.</p></li>
  <li><p>Do I have to use the test set for the estimation or the partitions of the folds of the dataset?</p></li>
  </ol>