from sklearn.preprocessing import OneHotEncoder
import numpy as np

# create a binary feature matrix
X = np.array([[1, 0, 1], [0, 1, 0], [1, 0, 0], [0, 1, 1]])

# create a OneHotEncoder object and specify to drop any binary feature
encoder = OneHotEncoder(drop='if_binary')

# fit and transform the binary feature matrix
X_encoded = encoder.fit_transform(X)

# convert the sparse matrix to a dense array for easy viewing
X_encoded_array = X_encoded.toarray()

# print the resulting binary feature matrix
print(X_encoded_array)