How to plot the decision boundary of different combinations of 2 features from 107 feature data set?

# like this but it is impossible to do like for 107 features.
for pairidx, pair in enumerate([[0, 1], [0, 2], [0, 3],
                                    [1, 2], [1, 3], [2, 3]]):
        # We only take the two corresponding features
        X = iris.data[:, pair]
        y = iris.target`

source: Scikit-learn

Any suggestions for such an approach?

So that I can link it to my program:

X = array[:,[51,98]]
X = StandardScaler().fit_transform(X)
y = array[:,0]
y = y.astype(int)
# OneHot encoding"
from sklearn.neighbors import KNeighborsClassifier`

#k = 15
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=0)

viz = DecisionViz(
    KNeighborsClassifier(10), title="Nearest Neighbors",
    features=['Feature One', 'Feature Two'], classes=['A', 'B']
viz.fit(X_train, y_train)
viz.draw(X_test, y_test)
print(viz.score(X_test, y_test))
viz.show(dpi = 300)

where X would be 2 out of 107 features and it would try every 2 combinations out of 107. Why would I do this, I wanted to see which 2 features were able to distinguish my 2 target classes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.