Skip to content
Permalink
d512478d60
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
1 lines (1 sloc) 994 Bytes
{"metadata":{"language_info":{"name":"python","version":"3.7.8","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"from sklearn.datasets import load_iris\ndt = load_iris()\nfrom sklearn.model_selection import train_test_split\nx_train,x_test,y_train,y_test = train_test_split(dt['data'], dt['target'], test_size=0.25, random_state=0)\nfrom sklearn.neighbors import KNeighborsClassifier\nmodel = KNeighborsClassifier(n_neighbors=1)\nmodel.fit(x_train,y_train)\ny_pred = model.predict(x_test)\nprint(\"Predictions:\\n\", y_pred)","metadata":{"trusted":true},"execution_count":4,"outputs":[{"name":"stdout","text":"Predictions:\n [2 1 0 2 0 2 0 1 1 1 2 1 1 1 1 0 1 1 0 0 2 1 0 0 2 0 0 1 1 0 2 1 0 2 2 1 0\n 2]\n","output_type":"stream"}]}]}