title: How can I calculate recall and precision if I have 4 x and y values in two dataset?
body: <p>I have two dataset(ground truth and predicted) and both have xmin, ymin,xmax and ymax values. I found some source codes but they are only for x and y values not 4 values. You can find the source code here. How can i change it to four values. Are there any idea?</p>
  <pre><code>from sklearn import datasets
  from sklearn.model_selection import train_test_split
  from sklearn.linear_model import LogisticRegression
  from sklearn.metrics import precision_recall_curve
  import matplotlib.pyplot as plt
  #create dataset with 5 predictor variables
  X, y = datasets.make_classification(n_samples=1000,
                                      n_features=4,
                                      n_informative=3,
                                      n_redundant=1,
                                      random_state=0)
  
  #split dataset into training and testing set
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.3,random_state=0)
  
  #fit logistic regression model to dataset
  classifier = LogisticRegression()
  classifier.fit(X_train, y_train)
  
  #use logistic regression model to make predictions
  y_score = classifier.predict_proba(X_test)[:, 1]
  
  #calculate precision and recall
  precision, recall, thresholds = precision_recall_curve(y_test, y_score)
  
  #create precision recall curve
  fig, ax = plt.subplots()
  ax.plot(recall, precision, color='purple')
  
  #add axis labels to plot
  ax.set_title('Precision-Recall Curve')
  ax.set_ylabel('Precision')
  ax.set_xlabel('Recall')
  
  #display plot
  plt.show()
  </code></pre>