title: Trying to understand an example script on ML
body: <p>I'm trying to work through an example script on machine learning: <a href="https://scikit-learn.org/stable/auto_examples/inspection/plot_linear_model_coefficient_interpretation.html#sphx-glr-auto-examples-inspection-plot-linear-model-coefficient-interpretation-py" rel="nofollow noreferrer">Common pitfalls in interpretation of coefficients of linear models</a> but I'm having trouble understanding some of the steps. The beginning of the script looks like this:</p>
  <pre><code>import numpy as np
  import scipy as sp
  import pandas as pd
  import matplotlib.pyplot as plt
  import seaborn as sns
  
  from sklearn.datasets import fetch_openml
  
  survey = fetch_openml(data_id=534, as_frame=True)
  
  # We identify features `X` and targets `y`: the column WAGE is our
  # target variable (i.e., the variable which we want to predict).
  X = survey.data[survey.feature_names]
  X.describe(include=&quot;all&quot;)
  
  X.head()
  
  # Our target for prediction is the wage.
  y = survey.target.values.ravel()
  survey.target.head()
  
  from sklearn.model_selection import train_test_split
  
  X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
  
  train_dataset = X_train.copy()
  train_dataset.insert(0, &quot;WAGE&quot;, y_train)
  _ = sns.pairplot(train_dataset, kind='reg', diag_kind='kde')
  </code></pre>
  <p>My problem is in the lines</p>
  <pre><code>y = survey.target.values.ravel()
  survey.target.head()
  </code></pre>
  <p>If we examine <code>survey.target.head()</code> immediately after these lines, the output is</p>
  <pre><code>Out[36]: 
  0    5.10
  1    4.95
  2    6.67
  3    4.00
  4    7.50
  Name: WAGE, dtype: float64
  </code></pre>
  <p>How does the model know that <code>WAGE</code> is the target variable? Does is not have to be explicitly declared?</p>