Evaluation
            pydts.evaluation
¤
    
            slicer = pd.IndexSlice
  
      module-attribute
  
¤
    
            event_specific_auc_at_t(pred_df, event, t, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the event specific AUC at time t.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate prediction error. Must contain the observed duration and event-type, and the probability of event at time t prediction results for the event. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                event
             | 
            
                  int
             | 
            
               Event-type to calculate the integrated AUC for.  | 
            required | 
                t
             | 
            
                  int
             | 
            
               time to calculate the AUC for.  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
result |             
                  Series
             | 
            
               event specific AUC for all times included in duration_col of pred_df.  | 
          
Source code in src/pydts/evaluation.py
              
            event_specific_auc_at_t_all(pred_df, event, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the event specific AUC at time t for all times included in duration_col of pred_df.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate prediction error. Must contain the observed duration and event-type, and the probability of event at time t prediction results for the event. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                event
             | 
            
                  int
             | 
            
               Event-type to calculate the AUC for.  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
result |             
                  Series
             | 
            
               event specific AUC for all times included in duration_col of pred_df.  | 
          
Source code in src/pydts/evaluation.py
              
            event_specific_brier_score_at_t(pred_df, event, t, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the event specific Brier Score at time t.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate Brier Score for. Must contain the observed duration and event-type, and the probability of event at time t prediction results for all events. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                event
             | 
            
                  int
             | 
            
               Event-type to calculate the Brier Score for.  | 
            required | 
                t
             | 
            
                  int
             | 
            
               time to calculate the Brier Score for.  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
result |             
                  Series
             | 
            
               event specific Brier Score at time t.  | 
          
Source code in src/pydts/evaluation.py
              
            event_specific_brier_score_at_t_all(pred_df, event, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the event specific Brier Score at time t for all times included in duration_col of pred_df.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate Brier Score. Must contain the observed duration and event-type, and the probability of event at time t prediction results for the event. TwoStagesFitter.predict_prob_events()  | 
            required | 
                event
             | 
            
                  int
             | 
            
               Event-type to calculate the Brier Score for.  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
result |             
                  Series
             | 
            
               event specific Brier Score for all times included in duration_col of pred_df.  | 
          
Source code in src/pydts/evaluation.py
              
            event_specific_integrated_auc(pred_df, event, event_type_col='J', duration_col='X', weights=None)
¤
    This function implements the calculation of the event specific integrated auc.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate prediction error. Must contain the observed duration and event-type, and the probability of event at time t prediction results for the event. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                event
             | 
            
                  int
             | 
            
               Event-type to calculate the integrated AUC for.  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
                weights
             | 
            
                  Series
             | 
            
               Optional. Weights vector with time as index and weight as value. Length must be the number of possible event times.  | 
            
                  None
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
result |             
                  float
             | 
            
               integrated AUC results.  | 
          
Source code in src/pydts/evaluation.py
              
            event_specific_integrated_brier_score(pred_df, event, event_type_col='J', duration_col='X', weights=None)
¤
    This function implements the calculation of the event specific integrated Brier Score.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate Brier Score. Must contain the observed duration and event-type, and the probability of event at time t prediction results for the event. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                event
             | 
            
                  int
             | 
            
               Event-type to calculate the integrated Brier Score for.  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
                weights
             | 
            
                  Series
             | 
            
               Optional. Weights vector with time as index and weight as value. Length must be the number of possible event times.  | 
            
                  None
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
result |             
                  float
             | 
            
               integrated Brier Score results.  | 
          
Source code in src/pydts/evaluation.py
              
            event_specific_weights(pred_df, event, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the event specific time-weights.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate prediction error. Must contain the observed duration and event-type, and the probability of event at time t prediction results for the event. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                event
             | 
            
                  int
             | 
            
               Event-type to calculate the weights for.  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
result |             
                  Series
             | 
            
               event specific weights.  | 
          
Source code in src/pydts/evaluation.py
              
            events_auc_at_t(pred_df, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the events AUC at t.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate AUC. Must contain the observed duration and event-type, and the probability of event at time t prediction results for all events. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
event_auc_at_t_df |             
                  DataFrame
             | 
            
               events AUC at t results.  | 
          
Source code in src/pydts/evaluation.py
              
            events_brier_score_at_t(pred_df, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the events Brier score at t.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate prediction error. Must contain the observed duration and event-type, and the probability of event at time t prediction results for all events. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
event_brier_score_at_t_df |             
                  DataFrame
             | 
            
               events Brier score at t results.  | 
          
Source code in src/pydts/evaluation.py
              
            events_integrated_auc(pred_df, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the integrated AUC to all events.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate prediction error. Must contain the observed duration and event-type, and the probability of event at time t prediction results for all events. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
integrated_auc |             
                  dict
             | 
            
               integrated AUC results.  | 
          
Source code in src/pydts/evaluation.py
              
            events_integrated_brier_score(pred_df, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the integrated Brier Score to all events.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate integrated Brier Score. Must contain the observed duration and event-type, and the probability of event at time t prediction results for all events. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
integrated_brier_score |             
                  dict
             | 
            
               integrated Brier Score results.  | 
          
Source code in src/pydts/evaluation.py
              
            global_auc(pred_df, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the global AUC.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate prediction error. Must contain the observed duration and event-type, and the probability of event at time t prediction results for all events. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
global_auc |             
                  float
             | 
            
               global AUC results.  | 
          
Source code in src/pydts/evaluation.py
              
            global_brier_score(pred_df, event_type_col='J', duration_col='X')
¤
    This function implements the calculation of the global Brier Score.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                pred_df
             | 
            
                  DataFrame
             | 
            
               Data to calculate Brier score. Must contain the observed duration and event-type, and the probability of event at time t prediction results for all events. See TwoStagesFitter.predict_prob_events()  | 
            required | 
                duration_col
             | 
            
                  str
             | 
            
               Last follow up time column name (must be a column in pred_df).  | 
            
                  'X'
             | 
          
                event_type_col
             | 
            
                  str
             | 
            
               The event type column name (must be a column in df), Right-censored sample (i) is indicated by event value 0, df.loc[i, event_type_col] = 0.  | 
            
                  'J'
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
global_auc |             
                  float
             | 
            
               global Brier Score results.  |