code: def newton(dataset, w_init, bias=True):
      """Implementation of the newton method with linesearch without privacy constraints
  
      dataset = dataset
      w_init = initialization point
  
      output is the model parameter
      """
      feature_vecs, labels = dataset
      if bias is True:
          feature_vecs = np.hstack(
              (
                  np.ones(shape=(np.shape(feature_vecs)[0], 1)),
                  feature_vecs,
              )
          )
      lrp = MyLogisticRegression(feature_vecs, labels, reg=1e-9)
      w_cur = w_init
      for _ in range(8):
          hess = lrp.hess(w_cur)
          dir_srch = np.linalg.solve(hess, lrp.grad_wor(w_cur))
          step_size = backtracking_ls(lrp, dir_srch, w_cur)
          w_cur = w_cur - step_size * dir_srch
      if lrp.loss_wor(w_cur) < lrp.loss_wor(w_init):
          w_out = w_cur
      else:
          w_out = w_init
      return w_out
  
imports: import os
  import ssl
  import tarfile
  import urllib.request
  from my_logistic_regression import MyLogisticRegression
  import numpy
  import requests
  from sklearn import preprocessing
  import sklearn.datasets
  from sklearn.linear_model import LogisticRegression
  import torch
  from torchvision import datasets, transforms
label_desc: Use image node_id 3 for calling a global function with example usage: newton(dataset, w_init, bias) and returns: w_out