title: Will a machine learning model be changed if passed as a parameter?
body: <p>I am creating a machine learning algorithm in python.
  Say I have:</p>
  
  <pre><code>alg = DecisionTreeClassifier(random_state=1)
  </code></pre>
  
  <p>then I create a function fit</p>
  
  <pre><code>def fit(X,Y,alg):
    alg.fit(X,Y)
  </code></pre>
  
  <p>and in my main I call</p>
  
  <pre><code>fit(X, Y, alg)
  Y_pred = alg.predict(X_test)
  </code></pre>
  
  <p>Will this work? Or alg is never really changed outside fit?</p>
  
  <p>I have read this question <a href="https://stackoverflow.com/questions/986006/how-do-i-pass-a-variable-by-reference">How do I pass a variable by reference?</a> but it is confusing since I do not know how my variable <code>alg</code> is changed.</p>
  
  <p>Thanks for your help.</p>