title: Classification Using DBSCAN w/ Test-Train Split
body: <p>The question proposed reads as follows: Use scikit-learn to split the data into a training and test set. Classify the data as either cat or dog using DBSCAN.</p>
  
  <p>I am trying to figure out how to go about using DBSCAN to fit a model using training data and then predict the labels of a testing set. I am well aware that DBSCAN is meant for clustering and not prediction. I have also looked at <a href="https://stackoverflow.com/questions/29625550/use-sklearn-dbscan-model-to-classify-new-entries">Use sklearn DBSCAN model to classify new entries</a> as well as numerous other threads.  DBSCAN only comes with fit and fit_predict functions, which don't seem relatively useful when trying to fit the model using the training data and then test the model using the testing data.</p>
  
  <p>Is the question worded poorly or am I missing something? I have looked at the scikit-learn documentation as well as looked for examples, but have not had any luck.</p>
  
  <pre class="lang-py prettyprint-override"><code># Split the samples into two subsets, use one for training and the other for testing
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
  
  # Instantiate the learning model
  dbscan = DBSCAN()
  
  # Fit the model
  dbscan.fit(X_train, y_train)
  
  # Predict the response
  
  # Confusion matrix and quantitative metrics
  print("The confusion matrix is: " + np.str(confusion_matrix(y_test, dbscan_pred)))
  print("The accuracy score is: " + np.str(accuracy_score(y_test, dbscan_pred)))
  </code></pre>