<commit_before># -*- coding: utf-8 -*-
from typing import List, Optional, Dict, Any
from textwrap import dedent, fill
from autograd import numpy as anp
import numpy as np
from pandas import DataFrame
from lifelines.statistics import proportional_hazard_test, TimeTransformers
from lifelines.utils import format_p_value
from lifelines.utils.lowess import lowess


class SplineFitterMixin:
    _scipy_fit_method = "SLSQP"
    _scipy_fit_options: Dict[str, Any] = {"ftol": 1e-10}

    @staticmethod
    def relu(x: np.ndarray):
        return anp.maximum(0, x)

    def basis(self, x: np.ndarray, knot: float, min_knot: float, max_knot: float):
        lambda_ = (max_knot - knot) / (max_knot - min_knot)
        return self.relu(x - knot) ** 3 - (
            lambda_ * self.relu(x - min_knot) ** 3 + (1 - lambda_) * self.relu(x - max_knot) ** 3
        )


class ProportionalHazardMixin:
    def check_assumptions(
        self,<commit_msg>remove this. slowed ending convergence by too much<commit_after># -*- coding: utf-8 -*-
from typing import List, Optional, Dict, Any
from textwrap import dedent, fill
from autograd import numpy as anp
import numpy as np
from pandas import DataFrame
from lifelines.statistics import proportional_hazard_test, TimeTransformers
from lifelines.utils import format_p_value
from lifelines.utils.lowess import lowess


class SplineFitterMixin:
    _scipy_fit_method = "SLSQP"

    @staticmethod
    def relu(x: np.ndarray):
        return anp.maximum(0, x)

    def basis(self, x: np.ndarray, knot: float, min_knot: float, max_knot: float):
        lambda_ = (max_knot - knot) / (max_knot - min_knot)
        return self.relu(x - knot) ** 3 - (
            lambda_ * self.relu(x - min_knot) ** 3 + (1 - lambda_) * self.relu(x - max_knot) ** 3
        )


class ProportionalHazardMixin:
    def check_assumptions(
        self,
{'fraction_non_alphanumeric': 0.09795479009687837, 'fraction_numerical': 0.008073196986006458, 'mean_word_length': 3.303240740740741, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6583691', 'n_tokens_mistral': 665, 'n_tokens_neox': 628, 'n_words': 183}