ratio-t2e


Nameratio-t2e JSON
Version 0.0.4 PyPI version JSON
download
home_page
SummaryLinear left barrier loss and data augmention for survival anlysis
upload_time2023-02-09 20:02:58
maintainer
docs_urlNone
author
requires_python>=3.7
licenseCopyright (c) 2018 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords survival ridge censored data ml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RATIO-T2E
This package contains 3 different elements: 
1. suRvival Analysis lefT barrIer lOss (RATIO) + uniFormatIve fEatureS daTa Augmentation (FIESTA) + Ridge model
2. suRvival Analysis lefT barrIer lOss (RATIO) - loss function
3. uniFormatIve fEatureS daTa Augmentation (FIESTA) class

### Prerequisites
Before you begin, ensure you have met the following requirements:
-  Checked for Windows only
- python 3.8

### Installing RATIO-T2E
pip install ratio-t2e

## suRvival Analysis lefT barrIer lOss (RATIO) + uniFormatIve fEatureS daTa Augmentation (FIESTA) + Ridge model
 
    This model solves a regression problem where the loss function is the Mean Square Error (MSE)
    for the uncensored data and the RATIO loss for the wrong censored samples.
    The user can moderate the relations between the censored and uncensored loss.
    For extremely small datasets ( < 50),  Data augmentatuin (DA) should be added. The combination of RATIO and DA
    is called FIESTA.


### Using suRvival Analysis lefT barrIer lOss (RATIO) + uniFormatIve fEatureS daTa Augmentation (FIESTA) + Ridge model
To use the model follow these steps:
1. Divide your data to a censored dataframe and an uncensored dataframe,
   where a sample is condisered as censored when its time of a competing event
   preceeds the time to event (TTE), or when a sample did not have an event within 
   the cohort's time.
   Make sure the dataframes consists of the following columns:
   - A TTE column for the uncensored dataframe and a competing times for the censored,
     that measures the times in days that have passes from the sample's date to the target date.
     
   - A column named "Date" of the date of the sample.
     
   - A column named "DateEnd" of the date of an event for uncensored, and date of competing event
    for censored.
    
   - A people column named similar to the people_col parameter, contains the identity of a patient.
   
   - A time column named similar to the time_col parameter, contains the order of samples for sequntial data.
   
   ### Example of the mendatory columns:
   
   ![image](https://user-images.githubusercontent.com/71209481/179836143-f07d6064-3798-421d-880b-9f977e7e980a.png)
   

   
2. Load the uncensored and censored datafrmes.
 #
    censored = pd.read_csv("censored_data_file_name.csv", index_col=0)
    uncensored = pd.read_csv("uncensored_data_file_name.csv", index_col=0)

3. Name the list of categorical features (name of columns).
#
    list_of_categories = ['cat1', 'cat2', 'cat3', 'cat4']

4. Create the LBL class with the parameters you want.
#
     lbl = LBL("TTE_col", "people_col", "time_col", num_of_bact=881, feature_selection=20, categories=list_of_categories,
              with_microbiome=False, augmented_censored=False, gamma=0.0)

5. Divide the uncensored dataframe into a training set and a test set.

6. Merge the uncensored training dataframe with the censored dataframe, for training.

7. Fit the model on the training set.

8. Use the predict function for prediction.

9. Use the score function for evaluations (Spearman Correlation Coefficient (SCC), AUC and  Concordance Index (CI).

## suRvival Analysis lefT barrIer lOss (RATIO) - loss function
Since the RATIO loss is "model-free", there is an option to add RATIO loss to any model.

### Using the RATIO loss
To use RATIO:
#

     import RATIO
     RATIO.RATIO(y,y_hat)

where y is a Tensor of shape (batch_size,2), its first dimension is a binary indicator of having the event (= 1) or lacking the event (= 0),
and its second dimension is the TTE.


## uniFormatIve fEatureS daTa Augmentation (FIESTA) class

   uniFormatIve fEatureS daTa Augmentation (FIESTA) defines the augmented TTE of the censored samples by using high dimensional
   and not highly informative data.
    The DA process contains 2 steps:
    
    1. Defining the augmented TTE as a weighted average of the uncensored samples based
    on the difference in M (high dimensional data) between samples (as described in our paper).
    There are 3 options for declaying functions Exponential (function_1), Hyperbolic (function_2) and Cauchy (function_3), which
    is the default.
    2. Computing the augmented TTE using Maximum Likelihood Estimation (MLE) on a model
    where a constant censoring rate of lamda is assumed and the event is normally distributed around the previously computed in step 1.

### Using FIESTA
To use FIESTA:
#
    import MLE_augmentor
    MLE_augmentor.FIESTA.implement_augment(censored_df,lamda)
    
such that censored_df has to contain the mendatory columns as was explained above, and lamda is the assumed censoring rate.

### Contributors
Shtossel Oshrit

### Contact
If you want to contact me you can reach me at oshritvig@gmail.com

### Citation


   
   
      

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ratio-t2e",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "survival,ridge,censored data,ML",
    "author": "",
    "author_email": "Oshrit Shtossel <oshritvig@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/27/26/5706a8f55e30a885e9cf01202d4a8b6c831c81ea81125ba77cd5598874ee/ratio_t2e-0.0.4.tar.gz",
    "platform": null,
    "description": "# RATIO-T2E\r\nThis package contains 3 different elements: \r\n1. suRvival Analysis lefT barrIer lOss (RATIO) + uniFormatIve fEatureS daTa Augmentation (FIESTA) + Ridge model\r\n2. suRvival Analysis lefT barrIer lOss (RATIO) - loss function\r\n3. uniFormatIve fEatureS daTa Augmentation (FIESTA) class\r\n\r\n### Prerequisites\r\nBefore you begin, ensure you have met the following requirements:\r\n-  Checked for Windows only\r\n- python 3.8\r\n\r\n### Installing RATIO-T2E\r\npip install ratio-t2e\r\n\r\n## suRvival Analysis lefT barrIer lOss (RATIO) + uniFormatIve fEatureS daTa Augmentation (FIESTA) + Ridge model\r\n \r\n    This model solves a regression problem where the loss function is the Mean Square Error (MSE)\r\n    for the uncensored data and the RATIO loss for the wrong censored samples.\r\n    The user can moderate the relations between the censored and uncensored loss.\r\n    For extremely small datasets ( < 50),  Data augmentatuin (DA) should be added. The combination of RATIO and DA\r\n    is called FIESTA.\r\n\r\n\r\n### Using suRvival Analysis lefT barrIer lOss (RATIO) + uniFormatIve fEatureS daTa Augmentation (FIESTA) + Ridge model\r\nTo use the model follow these steps:\r\n1. Divide your data to a censored dataframe and an uncensored dataframe,\r\n   where a sample is condisered as censored when its time of a competing event\r\n   preceeds the time to event (TTE), or when a sample did not have an event within \r\n   the cohort's time.\r\n   Make sure the dataframes consists of the following columns:\r\n   - A TTE column for the uncensored dataframe and a competing times for the censored,\r\n     that measures the times in days that have passes from the sample's date to the target date.\r\n     \r\n   - A column named \"Date\" of the date of the sample.\r\n     \r\n   - A column named \"DateEnd\" of the date of an event for uncensored, and date of competing event\r\n    for censored.\r\n    \r\n   - A people column named similar to the people_col parameter, contains the identity of a patient.\r\n   \r\n   - A time column named similar to the time_col parameter, contains the order of samples for sequntial data.\r\n   \r\n   ### Example of the mendatory columns:\r\n   \r\n   ![image](https://user-images.githubusercontent.com/71209481/179836143-f07d6064-3798-421d-880b-9f977e7e980a.png)\r\n   \r\n\r\n   \r\n2. Load the uncensored and censored datafrmes.\r\n #\r\n    censored = pd.read_csv(\"censored_data_file_name.csv\", index_col=0)\r\n    uncensored = pd.read_csv(\"uncensored_data_file_name.csv\", index_col=0)\r\n\r\n3. Name the list of categorical features (name of columns).\r\n#\r\n    list_of_categories = ['cat1', 'cat2', 'cat3', 'cat4']\r\n\r\n4. Create the LBL class with the parameters you want.\r\n#\r\n     lbl = LBL(\"TTE_col\", \"people_col\", \"time_col\", num_of_bact=881, feature_selection=20, categories=list_of_categories,\r\n              with_microbiome=False, augmented_censored=False, gamma=0.0)\r\n\r\n5. Divide the uncensored dataframe into a training set and a test set.\r\n\r\n6. Merge the uncensored training dataframe with the censored dataframe, for training.\r\n\r\n7. Fit the model on the training set.\r\n\r\n8. Use the predict function for prediction.\r\n\r\n9. Use the score function for evaluations (Spearman Correlation Coefficient (SCC), AUC and  Concordance Index (CI).\r\n\r\n## suRvival Analysis lefT barrIer lOss (RATIO) - loss function\r\nSince the RATIO loss is \"model-free\", there is an option to add RATIO loss to any model.\r\n\r\n### Using the RATIO loss\r\nTo use RATIO:\r\n#\r\n\r\n     import RATIO\r\n     RATIO.RATIO(y,y_hat)\r\n\r\nwhere y is a Tensor of shape (batch_size,2), its first dimension is a binary indicator of having the event (= 1) or lacking the event (= 0),\r\nand its second dimension is the TTE.\r\n\r\n\r\n## uniFormatIve fEatureS daTa Augmentation (FIESTA) class\r\n\r\n   uniFormatIve fEatureS daTa Augmentation (FIESTA) defines the augmented TTE of the censored samples by using high dimensional\r\n   and not highly informative data.\r\n    The DA process contains 2 steps:\r\n    \r\n    1. Defining the augmented TTE as a weighted average of the uncensored samples based\r\n    on the difference in M (high dimensional data) between samples (as described in our paper).\r\n    There are 3 options for declaying functions Exponential (function_1), Hyperbolic (function_2) and Cauchy (function_3), which\r\n    is the default.\r\n    2. Computing the augmented TTE using Maximum Likelihood Estimation (MLE) on a model\r\n    where a constant censoring rate of lamda is assumed and the event is normally distributed around the previously computed in step 1.\r\n\r\n### Using FIESTA\r\nTo use FIESTA:\r\n#\r\n    import MLE_augmentor\r\n    MLE_augmentor.FIESTA.implement_augment(censored_df,lamda)\r\n    \r\nsuch that censored_df has to contain the mendatory columns as was explained above, and lamda is the assumed censoring rate.\r\n\r\n### Contributors\r\nShtossel Oshrit\r\n\r\n### Contact\r\nIf you want to contact me you can reach me at oshritvig@gmail.com\r\n\r\n### Citation\r\n\r\n\r\n   \r\n   \r\n      \r\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2018 The Python Packaging Authority  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Linear left barrier loss and data augmention for survival anlysis",
    "version": "0.0.4",
    "split_keywords": [
        "survival",
        "ridge",
        "censored data",
        "ml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a3d8b28f529a8a0fb2aeac40864180b3a071571d60d7eac312580e02a5fd612d",
                "md5": "7623cf230360a5e65202aa2c6baf3f57",
                "sha256": "657851e72fdfd98a9a53bc1b1079400db60a04190f85f6668e9a18fefbf76906"
            },
            "downloads": -1,
            "filename": "ratio_t2e-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7623cf230360a5e65202aa2c6baf3f57",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 15486,
            "upload_time": "2023-02-09T20:02:55",
            "upload_time_iso_8601": "2023-02-09T20:02:55.822103Z",
            "url": "https://files.pythonhosted.org/packages/a3/d8/b28f529a8a0fb2aeac40864180b3a071571d60d7eac312580e02a5fd612d/ratio_t2e-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27265706a8f55e30a885e9cf01202d4a8b6c831c81ea81125ba77cd5598874ee",
                "md5": "d271a2772dba0f7c1ddab3e4b5833a99",
                "sha256": "1ba66d63d4ea51860cdf41696925bde1986780ddb76b21c10532bc2d3ada6995"
            },
            "downloads": -1,
            "filename": "ratio_t2e-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "d271a2772dba0f7c1ddab3e4b5833a99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 15031,
            "upload_time": "2023-02-09T20:02:58",
            "upload_time_iso_8601": "2023-02-09T20:02:58.157080Z",
            "url": "https://files.pythonhosted.org/packages/27/26/5706a8f55e30a885e9cf01202d4a8b6c831c81ea81125ba77cd5598874ee/ratio_t2e-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-09 20:02:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "ratio-t2e"
}
        
Elapsed time: 0.05151s