original_docstring: Mean squared error cost function with optional regularization.
  
          :param theta: ndarray; vector of weights.
          :param x: 2D ndarray; training data, examples in rows, features in cols.
          :param y: ndarray; (n, 1) shape.
          :param Lambda: int, float; If value is passed, regularization term will be added.
          :return: float; cost.
          
docstring: Mean squared error cost function with optional regularization.
docstring_tokens: Mean squared error cost function with optional regularization .
code: def mse_cost(theta, x, y, Lambda=None):
          """Mean squared error cost function with optional regularization.
  
          :param theta: ndarray; vector of weights.
          :param x: 2D ndarray; training data, examples in rows, features in cols.
          :param y: ndarray; (n, 1) shape.
          :param Lambda: int, float; If value is passed, regularization term will be added.
          :return: float; cost.
          """
          theta = theta.reshape(1, x.shape[1])
          cost = np.sum(np.power(x @ theta.T - y, 2)) / (2 * len(x))
          if Lambda:
              cost += MLFuncts.regularize(theta, Lambda, x.shape[0], 'cost')
          return cost
code_tokens: def mse_cost ( theta , x , y , Lambda = None ) : theta = theta . reshape ( 1 , x . shape [ 1 ] ) cost = np . sum ( np . power ( x @ theta . T - y , 2 ) ) / ( 2 * len ( x ) ) if Lambda : cost += MLFuncts . regularize ( theta , Lambda , x . shape [ 0 ] , 'cost' ) return cost
short_docstring: Mean squared error cost function with optional regularization.
short_docstring_tokens: Mean squared error cost function with optional regularization .
comment: """Mean squared error cost function with optional regularization.
  
          :param theta: ndarray; vector of weights.
          :param x: 2D ndarray; training data, examples in rows, features in cols.
          :param y: ndarray; (n, 1) shape.
          :param Lambda: int, float; If value is passed, regularization term will be added.
          :return: float; cost.
          """