





import numpy as np

def     UpperCAmelCase_						(						_UpperCAmelCase       :Optional[Any]							)  ->							Tuple:
     '''simple docstring'''


     A_      ,						A_					      =					a.shape
     A_					      =					min(_UpperCAmelCase     ,	_UpperCAmelCase							)
     A_					      =					np.eye(_UpperCAmelCase							)
     A_					      =					a.copy()

     for k in range(t - 1							):
          # select a column of modified matrix A':
          A_					      =					r[k:, [k]]
          # construct first basis vector
          A_					      =					np.zeros_like(_UpperCAmelCase							)
          A_					      =					1.0
          # determine scaling factor
          A_					      =					np.linalg.norm(_UpperCAmelCase							)
          # construct vector v for Householder reflection
          A_					      =					x + np.sign(x[0]							) * alpha * ea
          v /= np.linalg.norm(_UpperCAmelCase							)

          # construct the Householder matrix
          A_					      =					np.eye(m - k							) - 2.0 * v @ v.T
          # pad with ones and zeros as necessary
          A_					      =					np.block([[np.eye(_UpperCAmelCase							), np.zeros((k, m - k)							)], [np.zeros((m - k, k)							), q_k]]							)

          A_					      =					q @ q_k.T
          A_					      =					q_k @ r

     return q, r


if __name__ == "__main__":
      import doctest

      doctest.testmod()










from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier

# Load iris file
a__			:    List[str]			      =		load_iris()
iris.keys()


print(f'''Target names: \n {iris.target_names} ''')
print(f'''\n Features: \n {iris.feature_names}''')

# Train set e Test set
a__      ,							a__      ,							a__      ,							a__			:    Any			      =		train_test_split(
    iris['data'], iris['target'], random_state=4
)

# KNN

a__			:    List[Any]			      =		KNeighborsClassifier(n_neighbors=1)
knn.fit(X_train, y_train)

# new array to test
a__			:    Optional[Any]			      =		[[1, 2, 1, 4], [2, 3, 4, 5]]

a__			:    Union[str, Any]			      =		knn.predict(X_new)

print(
    f'''\nNew array: \n {X_new}\n\nTarget Names Prediction: \n'''
    f''' {iris['target_names'][prediction]}'''
)



