coveralls: 
[![Coverage Status](https://coveralls.io/builds/26432159/badge)](https://coveralls.io/builds/26432159)

Coverage remained the same at ?% when pulling **973d495dd6584d682a778cfb46cc02cea96b6436 on blu3r4y:fix-longest-strike** into **c3d35c42c799d1f36a1aca1d90ec0ab6450ce264 on blue-yonder:master**.

diff --git a/tsfresh/feature_extraction/feature_calculators.py b/tsfresh/feature_extraction/feature_calculators.py
index b5c8823..3df61b6 100644
--- a/tsfresh/feature_extraction/feature_calculators.py
+++ b/tsfresh/feature_extraction/feature_calculators.py
@@ -691,7 +691,7 @@ def longest_strike_below_mean(x):
     """
     if not isinstance(x, (np.ndarray, pd.Series)):
         x = np.asarray(x)
-    return np.max(_get_length_sequences_where(x <= np.mean(x))) if x.size > 0 else 0
+    return np.max(_get_length_sequences_where(x < np.mean(x))) if x.size > 0 else 0
 
 
 @set_property("fctype", "simple")
@@ -706,7 +706,7 @@ def longest_strike_above_mean(x):
     """
     if not isinstance(x, (np.ndarray, pd.Series)):
         x = np.asarray(x)
-    return np.max(_get_length_sequences_where(x >= np.mean(x))) if x.size > 0 else 0
+    return np.max(_get_length_sequences_where(x > np.mean(x))) if x.size > 0 else 0
 
 
 @set_property("fctype", "simple")

Off-by-one error in longest strike features
The two features `longest_strike_below_mean` and `longest_strike_above_mean` are implemented in a "less-than" and "greater-than" fashion, which yields incorrect results.

Here is a MWE where µ = 3 and the longest strike below and above is 2 - `tsfresh` yields 3.

```
assert fc.longest_strike_below_mean([1, 2, 3, 4, 5]) == 2
assert fc.longest_strike_above_mean([1, 2, 3, 4, 5]) == 2
```

diff --git a/tests/units/feature_extraction/test_feature_calculations.py b/tests/units/feature_extraction/test_feature_calculations.py
index 129e9c3..942e1a1 100644
--- a/tests/units/feature_extraction/test_feature_calculations.py
+++ b/tests/units/feature_extraction/test_feature_calculations.py
@@ -372,11 +372,15 @@ class FeatureCalculationTestCase(TestCase):
 
     def test_longest_strike_below_mean(self):
         self.assertEqualOnAllArrayTypes(longest_strike_below_mean, [1, 2, 1, 1, 1, 2, 2, 2], 3)
+        self.assertEqualOnAllArrayTypes(longest_strike_below_mean, [1, 2, 3, 4, 5, 6], 3)
+        self.assertEqualOnAllArrayTypes(longest_strike_below_mean, [1, 2, 3, 4, 5], 2)
         self.assertEqualOnAllArrayTypes(longest_strike_below_mean, [1, 2, 1], 1)
         self.assertEqualOnAllArrayTypes(longest_strike_below_mean, [], 0)
 
     def test_longest_strike_above_mean(self):
         self.assertEqualOnAllArrayTypes(longest_strike_above_mean, [1, 2, 1, 2, 1, 2, 2, 1], 2)
+        self.assertEqualOnAllArrayTypes(longest_strike_above_mean, [1, 2, 3, 4, 5, 6], 3)
+        self.assertEqualOnAllArrayTypes(longest_strike_above_mean, [1, 2, 3, 4, 5], 2)
         self.assertEqualOnAllArrayTypes(longest_strike_above_mean, [1, 2, 1], 1)
         self.assertEqualOnAllArrayTypes(longest_strike_above_mean, [], 0)
 

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.5.2
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
click==8.0.4
cloudpickle==2.2.1
contextvars==2.4
coverage==6.2
dask==2021.3.0
distributed==2021.3.0
execnet==1.9.0
future==1.0.0
HeapDict==1.0.1
idna==3.10
immutables==0.19
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
joblib==1.1.1
msgpack==1.0.5
numpy==1.19.5
packaging==21.3
pandas==0.23.4
patsy==1.0.1
pluggy==1.0.0
psutil==7.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.1
requests==2.27.1
scikit-learn==0.24.2
scipy==1.5.4
six==1.17.0
sortedcontainers==2.4.0
statsmodels==0.12.2
tblib==1.7.0
threadpoolctl==3.1.0
tomli==1.2.3
toolz==0.12.0
tornado==6.1
tqdm==4.64.1
-e git+https://github.com/blue-yonder/tsfresh.git@c3d35c42c799d1f36a1aca1d90ec0ab6450ce264#egg=tsfresh
typing_extensions==4.1.1
urllib3==1.26.20
zict==2.1.0
zipp==3.6.0

name: tsfresh
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - charset-normalizer==2.0.12
      - click==8.0.4
      - cloudpickle==2.2.1
      - contextvars==2.4
      - coverage==6.2
      - dask==2021.3.0
      - distributed==2021.3.0
      - execnet==1.9.0
      - future==1.0.0
      - heapdict==1.0.1
      - idna==3.10
      - immutables==0.19
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - joblib==1.1.1
      - msgpack==1.0.5
      - numpy==1.19.5
      - packaging==21.3
      - pandas==0.23.4
      - patsy==1.0.1
      - pluggy==1.0.0
      - psutil==7.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-asyncio==0.16.0
      - pytest-cov==4.0.0
      - pytest-mock==3.6.1
      - pytest-xdist==3.0.2
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyyaml==6.0.1
      - requests==2.27.1
      - scikit-learn==0.24.2
      - scipy==1.5.4
      - six==1.17.0
      - sortedcontainers==2.4.0
      - statsmodels==0.12.2
      - tblib==1.7.0
      - threadpoolctl==3.1.0
      - tomli==1.2.3
      - toolz==0.12.0
      - tornado==6.1
      - tqdm==4.64.1
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zict==2.1.0
      - zipp==3.6.0
prefix: /opt/conda/envs/tsfresh

tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_longest_strike_below_mean tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_longest_strike_above_mean
tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_ar_coefficient tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_partial_autocorrelation
tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_last_location_of_minimum tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_agg_autocorrelation_returns_correct_values tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_sum tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_first_location_of_maximum tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_count_below_mean tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_median tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_abs_energy tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_augmented_dickey_fuller tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_uniqueness_factor tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_time_reversal_asymmetry_statistic tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_last_location_maximum tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_large_standard_deviation tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_autocorrelation tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test__aggregate_on_chunks tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_cid_ce tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_count_above_mean tests/units/feature_extraction/test_feature_calculations.py::FriedrichTestCase::test_friedrich_coefficients tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_c3 tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_variance_larger_than_standard_deviation tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_spkt_welch_density tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_approximate_entropy tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_mean_second_derivate_central tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_value_count tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_absolute_sum_of_changes tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_standard_deviation tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_symmetry_looking tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_ratio_beyond_r_sigma tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_linear_trend_timewise_hours tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_number_crossing_m tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_has_duplicate_min tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_linear_trend_timewise_seconds tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_percentage_of_doubled_datapoints tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_energy_ratio_by_chunks tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test___get_length_sequences_where tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_has_duplicate tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_mean_abs_change tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_kurtosis tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_mass_quantile tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_linear_trend tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_agg_autocorrelation_returns_max_lag_does_not_affect_other_results tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_sum_of_reoccurring_data_points tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_fft_coefficient tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_length tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_number_cwt_peaks tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_cwt_coefficients tests/units/feature_extraction/test_feature_calculations.py::FriedrichTestCase::test_friedrich_number_of_returned_features_is_equal_to_number_of_parameters tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_linear_trend_timewise_years tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_binned_entropy tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_variance tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_mean tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_ratio_of_doubled_values tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_range_count tests/units/feature_extraction/test_feature_calculations.py::FriedrichTestCase::test_friedrich_equal_to_snapshot tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_first_location_of_minimum tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_has_duplicate_max tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test__roll tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_skewness tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_agg_linear_trend tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_sum_of_reoccurring_values tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_number_peaks tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_quantile tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_linear_trend_timewise_days tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_fft_aggregated tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_mean_change tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_sample_entropy tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_mean_abs_change_quantiles tests/units/feature_extraction/test_feature_calculations.py::FriedrichTestCase::test_estimate_friedrich_coefficients tests/units/feature_extraction/test_feature_calculations.py::FeatureCalculationTestCase::test_max_langevin_fixed_point
tsfresh/feature_extraction/feature_calculators.py
tsfresh/feature_extraction/feature_calculators.py