class: center, middle ![:scale 40%](images/sklearn_logo.png) ### Intermediate Machine learning with scikit-learn # Reminder: Scikit-learn API Andreas C. Müller Columbia University, scikit-learn .smaller[https://github.com/amueller/ml-workshop-2-of-4] --- class: center # scikit-learn documentation ![:scale 60%](images/sklearn-docs.png)
scikit-learn.org
--- # Other Resources .center[ ![:scale 25%](images/PDSH.png) ![:scale 25%](images/imlp.png) ![:scale 25%](images/esl.png) ] Lecture: http://www.cs.columbia.edu/~amueller/comsw4995s19/schedule/ https://www.youtube.com/andreasmueller Videos and more slides! --- class: center # Representing Data ![:scale 100%](images/matrix-representation.png) --- class: center # Training and Test Data ![:scale 80%](images/train-test-split.png) --- class: center # Supervised ML Workflow ![:scale 100%](images/supervised-ml-api.png) --- # KNN with scikit-learn ```python from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y) from sklearn.neighbors import KNeighborsClassifier knn = KNeighborsClassifier(n_neighbors=1) knn.fit(X_train, y_train) print("accuracy: ", knn.score(X_test, y_test))) y_pred = knn.predict(X_test) ``` accuracy: 0.77 ??? --- class: center, middle # Sckit-Learn API Summary ![:scale 80%](images/api-table.png) --- class: center, middle # Notebook: Review of Supervised learning