code: def test_weighted_correlations():
      """Check weighted Pearson correlation coefficient matches scipy"""
  
      random_state = check_random_state(415)
      x1 = random_state.uniform(size=500)
      x2 = random_state.uniform(size=500)
      w1 = np.ones(500)
      w2 = random_state.uniform(size=500)
  
      # Pearson's correlation coefficient
      scipy_pearson = pearsonr(x1, x2)[0]
      # Check with constant weights (should be equal)
      gplearn_pearson = weighted_pearson(x1, x2, w1)
      assert_almost_equal(scipy_pearson, gplearn_pearson)
      # Check with irregular weights (should be different)
      gplearn_pearson = weighted_pearson(x1, x2, w2)
      assert abs(scipy_pearson - gplearn_pearson) > 0.01
  
      # Spearman's correlation coefficient
      scipy_spearman = spearmanr(x1, x2)[0]
      # Check with constant weights (should be equal)
      gplearn_spearman = weighted_spearman(x1, x2, w1)
      assert_almost_equal(scipy_spearman, gplearn_spearman)
      # Check with irregular weights (should be different)
      gplearn_spearman = weighted_pearson(x1, x2, w2)
      assert abs(scipy_spearman - gplearn_spearman) > 0.01
  
imports: import pickle
  import pytest
  import sys
  from io import StringIO
  import numpy
  from scipy.stats import pearsonr, spearmanr
  from sklearn.datasets import load_diabetes, load_breast_cancer
  from sklearn.metrics import mean_absolute_error
  from sklearn.model_selection import GridSearchCV
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import StandardScaler
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.utils._testing import assert_almost_equal
  from sklearn.utils._testing import assert_array_equal
  from sklearn.utils._testing import assert_array_almost_equal
  from sklearn.utils._testing import assert_raises
  from sklearn.utils.validation import check_random_state
  from gplearn.genetic import SymbolicClassifier, SymbolicRegressor
  from gplearn.genetic import SymbolicTransformer
  from gplearn.fitness import weighted_pearson, weighted_spearman
  from gplearn._program import _Program
  from gplearn.fitness import _fitness_map
  from gplearn.functions import add2, sub2, mul2, div2, sqrt1, log1, abs1, max2, min2
  from gplearn.functions import _Function
label_desc: Use image node_id 1 for calling a global function with example usage: test_weighted_correlations() without return types