code: def test_movielens_accuracy_sample_weights():
      # Scaling weights down and learning rate up
      # by the same amount should result in
      # roughly the same accuracy
  
      scale = 0.5
      weights = train.copy()
      weights.data = np.ones(train.getnnz(), dtype=np.float32) * scale
  
      for loss, exp_score in (
          ("logistic", 0.74),
          ("bpr", 0.84),
          ("warp", 0.89),
      ):
          model = LightFM(loss=loss, random_state=SEED)
          model.learning_rate * 1.0 / scale
  
          model.fit_partial(train, sample_weight=weights, epochs=10)
  
          (
              train_precision,
              test_precision,
              full_train_auc,
              full_test_auc,
          ) = _get_metrics(model, train, test)
  
          assert full_train_auc > exp_score
  
imports: import pickle
  import numpy
  import scipy.sparse
  from scipy import stats
  from sklearn.metrics import roc_auc_score
  from sklearn.model_selection import KFold, RandomizedSearchCV
  from lightfm.lightfm import LightFM
  from lightfm.datasets import fetch_movielens
  from lightfm.evaluation import auc_score, precision_at_k
label_desc: Use image node_id 23 for calling a global function with example usage: test_movielens_accuracy_sample_weights() without return types