class_docstr: This class fits the regression model:
  
  .. math::  h(t|x)  = b_0(t) + b_1(t) x_1 + ... + b_N(t) x_N
  
  that is, the hazard rate is a linear function of the covariates with time-varying coefficients.
  This implementation assumes non-time-varying covariates, see ``TODO: name``
  
  Note
  -----
  
  This class was rewritten in lifelines 0.17.0 to focus solely on static datasets.
  There is no guarantee of backwards compatibility.
  
  Parameters
  -----------
  fit_intercept: bool, optional (default: True)
    If False, do not attach an intercept (column of ones) to the covariate matrix. The
    intercept, :math:`b_0(t)` acts as a baseline hazard.
  alpha: float, optional (default=0.05)
    the level in the confidence intervals.
  coef_penalizer: float, optional (default: 0)
    Attach a L2 penalizer to the size of the coefficients during regression. This improves
    stability of the estimates and controls for high correlation between covariates.
    For example, this shrinks the magnitude of :math:`c_{i,t}`.
  smoothing_penalizer: float, optional (default: 0)
    Attach a L2 penalizer to difference between adjacent (over time) coefficients. For
    example, this shrinks the magnitude of :math:`c_{i,t} - c_{i,t+1}`.
  
  Attributes
  ----------
  cumulative_hazards_ : DataFrame
      The estimated cumulative hazard
  hazards_ : DataFrame
      The estimated hazards
  confidence_intervals_ : DataFrame
      The lower and upper confidence intervals for the cumulative hazard
  durations: array
      The durations provided
  event_observed: array
      The event_observed variable provided
  weights: array
      The event_observed variable provided
class_docstr_tok: ["This","class","fits","the","regression","model",":","..","math",":",":","h","(","t|x",")","=","b_0","(","t",")","+","b_1","(","t",")","x_1","+","...","+","b_N","(","t",")","x_N","that","is",",","the","hazard","rate","is","a","linear","function","of","the","covariates","with","time-varying","coefficients",".","This","implementation","assumes","non-time-varying","covariates",",","see","``","TODO",":","name","``","Note","--","--","-","This","class","was","rewritten","in","lifelines","0.17.0","to","focus","solely","on","static","datasets",".","There","is","no","guarantee","of","backwards","compatibility",".","Parameters","--","--","--","--","--","-","fit_intercept",":","bool",",","optional","(","default",":","True",")","If","False",",","do","not","attach","an","intercept","(","column","of","ones",")","to","the","covariate","matrix",".","The","intercept",",",":","math",":","`","b_0","(","t",")","`","acts","as","a","baseline","hazard",".","alpha",":","float",",","optional","(","default=0.05",")","the","level","in","the","confidence","intervals",".","coef_penalizer",":","float",",","optional","(","default",":","0",")","Attach","a","L2","penalizer","to","the","size","of","the","coefficients","during","regression",".","This","improves","stability","of","the","estimates","and","controls","for","high","correlation","between","covariates",".","For","example",",","this","shrinks","the","magnitude","of",":","math",":","`","c_","{","i",",","t","}","`",".","smoothing_penalizer",":","float",",","optional","(","default",":","0",")","Attach","a","L2","penalizer","to","difference","between","adjacent","(","over","time",")","coefficients",".","For","example",",","this","shrinks","the","magnitude","of",":","math",":","`","c_","{","i",",","t","}","-","c_","{","i",",","t+1","}","`",".","Attributes","--","--","--","--","--","cumulative_hazards_",":","DataFrame","The","estimated","cumulative","hazard","hazards_",":","DataFrame","The","estimated","hazards","confidence_intervals_",":","DataFrame","The","lower","and","upper","confidence","intervals","for","the","cumulative","hazard","durations",":","array","The","durations","provided","event_observed",":","array","The","event_observed","variable","provided","weights",":","array","The","event_observed","variable","provided"]
docstr: Parameters
  ----------
  Fit the Aalen Additive model to a dataset.
  
  Parameters
  ----------
  df: DataFrame
      a Pandas DataFrame with necessary columns `duration_col` and
      `event_col` (see below), covariates columns, and special columns (weights).
      `duration_col` refers to
      the lifetimes of the subjects. `event_col` refers to whether
      the 'death' events was observed: 1 if observed, 0 else (censored).
  
  duration_col: string
      the name of the column in DataFrame that contains the subjects'
      lifetimes.
  
  event_col: string, optional
      the  name of the column in DataFrame that contains the subjects' death
      observation. If left as None, assume all individuals are uncensored.
  
  weights_col: string, optional
      an optional column in the DataFrame, df, that denotes the weight per subject.
      This column is expelled and not used as a covariate, but as a weight in the
      final regression. Default weight is 1.
      This can be used for case-weights. For example, a weight of 2 means there were two subjects with
      identical observations.
      This can be used for sampling weights.
  
  show_progress: bool, optional (default=False)
      Since the fitter is iterative, show iteration number.
  
  formula: str
      an R-like formula
  
  
  Returns
  -------
  self: AalenAdditiveFitter
      self with additional new properties: ``cumulative_hazards_``, etc.
  
  Examples
  --------
  .. code:: python
  
      from lifelines import AalenAdditiveFitter
  
      df = pd.DataFrame({
          'T': [5, 3, 9, 8, 7, 4, 4, 3, 2, 5, 6, 7],
          'E': [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0],
          'var': [0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2],
          'age': [4, 3, 9, 8, 7, 4, 4, 3, 2, 5, 6, 7],
      })
  
      aaf = AalenAdditiveFitter()
      aaf.fit(df, 'T', 'E')
      aaf.predict_median(df)
      aaf.print_summary()
docstr_tok: ["Parameters","--","--","--","--","--","Fit","the","Aalen","Additive","model","to","a","dataset",".","Parameters","--","--","--","--","--","df",":","DataFrame","a","Pandas","DataFrame","with","necessary","columns","`","duration_col","`","and","`","event_col","`","(","see","below",")",",","covariates","columns",",","and","special","columns","(","weights",")",".","`","duration_col","`","refers","to","the","lifetimes","of","the","subjects",".","`","event_col","`","refers","to","whether","the","'death","'","events","was","observed",":","1","if","observed",",","0","else","(","censored",")",".","duration_col",":","string","the","name","of","the","column","in","DataFrame","that","contains","the","subjects'","lifetimes",".","event_col",":","string",",","optional","the","name","of","the","column","in","DataFrame","that","contains","the","subjects","'","death","observation",".","If","left","as","None",",","assume","all","individuals","are","uncensored",".","weights_col",":","string",",","optional","an","optional","column","in","the","DataFrame",",","df",",","that","denotes","the","weight","per","subject",".","This","column","is","expelled","and","not","used","as","a","covariate",",","but","as","a","weight","in","the","final","regression",".","Default","weight","is","1",".","This","can","be","used","for","case-weights",".","For","example",",","a","weight","of","2","means","there","were","two","subjects","with","identical","observations",".","This","can","be","used","for","sampling","weights",".","show_progress",":","bool",",","optional","(","default=False",")","Since","the","fitter","is","iterative",",","show","iteration","number",".","formula",":","str","an","R-like","formula","Returns","--","--","--","-","self",":","AalenAdditiveFitter","self","with","additional","new","properties",":","``","cumulative_hazards_","``",",","etc",".","Examples","--","--","--","--","..","code",":",":","python","from","lifelines","import","AalenAdditiveFitter","df","=","pd.DataFrame","(","{","'T","'",":","[","5",",","3",",","9",",","8",",","7",",","4",",","4",",","3",",","2",",","5",",","6",",","7","]",",","'","E","'",":","[","1",",","1",",","1",",","1",",","1",",","1",",","0",",","0",",","1",",","1",",","1",",","0","]",",","'var","'",":","[","0",",","0",",","0",",","0",",","1",",","1",",","1",",","1",",","1",",","2",",","2",",","2","]",",","'age","'",":","[","4",",","3",",","9",",","8",",","7",",","4",",","4",",","3",",","2",",","5",",","6",",","7","]",",","}",")","aaf","=","AalenAdditiveFitter","(",")","aaf.fit","(","df",",","'T","'",",","'","E","'",")","aaf.predict_median","(","df",")","aaf.print_summary","(",")"]
code: def fit(
      self,
      df,
      duration_col,
      event_col=None,
      weights_col=None,
      show_progress=False,
      formula: str = None,
  ):
      """
      Parameters
      ----------
      Fit the Aalen Additive model to a dataset.
  
      Parameters
      ----------
      df: DataFrame
          a Pandas DataFrame with necessary columns `duration_col` and
          `event_col` (see below), covariates columns, and special columns (weights).
          `duration_col` refers to
          the lifetimes of the subjects. `event_col` refers to whether
          the 'death' events was observed: 1 if observed, 0 else (censored).
  
      duration_col: string
          the name of the column in DataFrame that contains the subjects'
          lifetimes.
  
      event_col: string, optional
          the  name of the column in DataFrame that contains the subjects' death
          observation. If left as None, assume all individuals are uncensored.
  
      weights_col: string, optional
          an optional column in the DataFrame, df, that denotes the weight per subject.
          This column is expelled and not used as a covariate, but as a weight in the
          final regression. Default weight is 1.
          This can be used for case-weights. For example, a weight of 2 means there were two subjects with
          identical observations.
          This can be used for sampling weights.
  
      show_progress: bool, optional (default=False)
          Since the fitter is iterative, show iteration number.
  
      formula: str
          an R-like formula
  
  
      Returns
      -------
      self: AalenAdditiveFitter
          self with additional new properties: ``cumulative_hazards_``, etc.
  
      Examples
      --------
      .. code:: python
  
          from lifelines import AalenAdditiveFitter
  
          df = pd.DataFrame({
              'T': [5, 3, 9, 8, 7, 4, 4, 3, 2, 5, 6, 7],
              'E': [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0],
              'var': [0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2],
              'age': [4, 3, 9, 8, 7, 4, 4, 3, 2, 5, 6, 7],
          })
  
          aaf = AalenAdditiveFitter()
          aaf.fit(df, 'T', 'E')
          aaf.predict_median(df)
          aaf.print_summary()
  
      """
      self._time_fit_was_called = (
          datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") + " UTC"
      )
  
      df = df.copy()
  
      self.duration_col = duration_col
      self.event_col = event_col
      self.weights_col = weights_col
      self.formula = formula
  
      self._n_examples = df.shape[0]
  
      X, T, E, weights = self._preprocess_dataframe(df)
  
      self.durations = T.copy()
      self.event_observed = E.copy()
      self.weights = weights.copy()
  
      self._norm_std = X.std(0)
  
      # if we included an intercept, we need to fix not divide by zero.
      if self.fit_intercept:
          self._norm_std["Intercept"] = 1.0
      else:
          # a _intercept was provided
          self._norm_std[self._norm_std < 1e-8] = 1.0
  
      (
          self.hazards_,
          self.cumulative_hazards_,
          self.cumulative_variance_,
      ) = self._fit_model(
          normalize(X, 0, self._norm_std), T, E, weights, show_progress
      )
      self.hazards_ /= self._norm_std
      self.cumulative_hazards_ /= self._norm_std
      self.cumulative_variance_ /= self._norm_std
      self.confidence_intervals_ = self._compute_confidence_intervals()
  
      self._index = self.hazards_.index
  
      self._predicted_hazards_ = (
          self.predict_cumulative_hazard(df).iloc[-1].values.ravel()
      )
      return self
  
imports: import warnings
  from datetime import datetime
  import time
  import numpy
  import pandas
  from numpy.linalg import LinAlgError
  from scipy.integrate import trapz
  from lifelines.fitters import RegressionFitter
  from lifelines.utils.printer import Printer
  from lifelines.exceptions import StatisticalWarning, ConvergenceWarning
  from lifelines import utils
  from lifelines.utils import _get_index, inv_normal_cdf, epanechnikov_kernel, ridge_regression, qth_survival_times, check_for_numeric_dtypes_or_raise, concordance_index, check_nans_or_infs, normalize, string_rjustify, _to_list, format_floats, format_p_value, format_exp_floats, survival_table_from_events, CensoringType
label_desc: Use image node_id 2 for calling the AalenAdditiveFitter obj's underlying member method code with example usage: obj.fit(df, duration_col, event_col, weights_col, show_progress, formula) and returns: self