likelycause2


Namelikelycause2 JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/Ana-c-ng/likelycause2
SummaryLikely cause finds creative ways to identify causes
upload_time2020-10-23 17:30:34
maintainer
docs_urlNone
authorAna Garcia
requires_python>=2.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Likelycause2

Likelycause is an utility package that uses several functions to attribute causes to variations. Using a combination of arithmetical decompositions and bayesian techniques, this was built to facilitate the workflow of a data-analyst working for the private sector.

## What the package contains
This package has everything built under the likelycause2 module, so all the functions should be called using “likelycause2.”. Currently, we have 1 auxiliary function and 1 causal function.

### Auxiliary functions
- likelycause2.last_period: The last period function is a utility function that builds variation variables in a dataframe._

### Causal functions
- likelycause2.bayes_suspects: The bayes_suspects function calculates the conditional probabilities of the event and each suspicious causes or a combination of those causes.  It also suggests an attribution to each individual cause, by adjusting the intersections of causes

## Likelycause2.last_period

### Description:
The last period function is a utility function that builds variation variables in a dataframe.
Variations are defined between moment t and a moment in the past.

### Arguments:

- df (pd.DataFrame): the dataframe
- unique_id (string): unique identifier of each line. Must be unique, and can only be 1 column
- interval (string): what is the interval you want to calculate variations for. Accepts days, weeks and hours
- periods (int): number of periods you want to look back on that interval. For last variations, for example, the argument period would be 1
- date_column (string): the date column in your dateframe. Must be a datetime. To convert, use pandas.to_datetime function
- to_past (list): list of columns you want to calculate the variations for

### Returns:
Returns the dataframe that was inputed with additinal columns named v+name of the columns in the to_past argument. Those columns represent the variation of that variable between moment t and t-periods. This variation is calculated as (Variable in moment t)/(Variable in moment t-periods).


## Likelycause2.bayes_suspects

### Description:
The bayes_suspects function calculates the conditional probabilities of the event and each suspicious causes or a combination of those causes. 
It also suggests an attribution to each individual cause, by adjusting the intersections of causes

### Arguments:

- df (pd.DataFrame): the dataframe
- event (string): name of the column that contains the event that we want to explain
- suspects (list): list with name of the columns that contains the potential causes for what we want to explain
- point (dictionary): dictionary with the point for which we want to calculate the probability. Must be a combination of the cause and all the individual points of suspects

### Returns:
Returns a dataframe with all the possible probabilities combinations, and the conditional probabilities:

- name: name of that conditional combination. If it has one event, it represents P(event|a). If it has 2 events it represents P(event1 & event2|a)
- prob_ba: P(cause | event)
- prob_a: P(cause)
- prob_b: P(event)
- pbayes: confitional probability
- pbayes_attribution: suggested probability attribution if we want to attribute to individual causes



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Ana-c-ng/likelycause2",
    "name": "likelycause2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ana Garcia",
    "author_email": "ana.n.garcia2@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/66/2d/bddfedbbbbb03c0e38c5713944b0bd63a9afe8924fe170806019f014d4e8/likelycause2-0.1.8.tar.gz",
    "platform": "",
    "description": "# Likelycause2\n\nLikelycause is an utility package that uses several functions to attribute causes to variations. Using a combination of arithmetical decompositions and bayesian techniques, this was built to facilitate the workflow of a data-analyst working for the private sector.\n\n## What the package contains\nThis package has everything built under the likelycause2 module, so all the functions should be called using \u201clikelycause2.\u201d. Currently, we have 1 auxiliary function and 1 causal function.\n\n### Auxiliary functions\n- likelycause2.last_period: The last period function is a utility function that builds variation variables in a dataframe._\n\n### Causal functions\n- likelycause2.bayes_suspects: The bayes_suspects function calculates the conditional probabilities of the event and each suspicious causes or a combination of those causes.  It also suggests an attribution to each individual cause, by adjusting the intersections of causes\n\n## Likelycause2.last_period\n\n### Description:\nThe last period function is a utility function that builds variation variables in a dataframe.\nVariations are defined between moment t and a moment in the past.\n\n### Arguments:\n\n- df (pd.DataFrame): the dataframe\n- unique_id (string): unique identifier of each line. Must be unique, and can only be 1 column\n- interval (string): what is the interval you want to calculate variations for. Accepts days, weeks and hours\n- periods (int): number of periods you want to look back on that interval. For last variations, for example, the argument period would be 1\n- date_column (string): the date column in your dateframe. Must be a datetime. To convert, use pandas.to_datetime function\n- to_past (list): list of columns you want to calculate the variations for\n\n### Returns:\nReturns the dataframe that was inputed with additinal columns named v+name of the columns in the to_past argument. Those columns represent the variation of that variable between moment t and t-periods. This variation is calculated as (Variable in moment t)/(Variable in moment t-periods).\n\n\n## Likelycause2.bayes_suspects\n\n### Description:\nThe bayes_suspects function calculates the conditional probabilities of the event and each suspicious causes or a combination of those causes. \nIt also suggests an attribution to each individual cause, by adjusting the intersections of causes\n\n### Arguments:\n\n- df (pd.DataFrame): the dataframe\n- event (string): name of the column that contains the event that we want to explain\n- suspects (list): list with name of the columns that contains the potential causes for what we want to explain\n- point (dictionary): dictionary with the point for which we want to calculate the probability. Must be a combination of the cause and all the individual points of suspects\n\n### Returns:\nReturns a dataframe with all the possible probabilities combinations, and the conditional probabilities:\n\n- name: name of that conditional combination. If it has one event, it represents P(event|a). If it has 2 events it represents P(event1 & event2|a)\n- prob_ba: P(cause | event)\n- prob_a: P(cause)\n- prob_b: P(event)\n- pbayes: confitional probability\n- pbayes_attribution: suggested probability attribution if we want to attribute to individual causes\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Likely cause finds creative ways to identify causes",
    "version": "0.1.8",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "24ee1e105a936af6f0809d9891e39d03",
                "sha256": "04e7b035883c8fd1c8d1844790a5a83694b7f68cb492ccb9e23ff29f3ee1b67c"
            },
            "downloads": -1,
            "filename": "likelycause2-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "24ee1e105a936af6f0809d9891e39d03",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=2.7",
            "size": 5768,
            "upload_time": "2020-10-23T17:30:32",
            "upload_time_iso_8601": "2020-10-23T17:30:32.593258Z",
            "url": "https://files.pythonhosted.org/packages/c7/92/eb81054c7c2865a5ee782f7c2e5cf4365dd256d2f9ba43a492cfe3c07ab1/likelycause2-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "66068ecd9aa183db14f741a8158fff8a",
                "sha256": "c4c848833f6382f8a46f7098edd660d02700e3f10069ae9cdf0e4dfc6611b6ca"
            },
            "downloads": -1,
            "filename": "likelycause2-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "66068ecd9aa183db14f741a8158fff8a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 4329,
            "upload_time": "2020-10-23T17:30:34",
            "upload_time_iso_8601": "2020-10-23T17:30:34.098366Z",
            "url": "https://files.pythonhosted.org/packages/66/2d/bddfedbbbbb03c0e38c5713944b0bd63a9afe8924fe170806019f014d4e8/likelycause2-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-10-23 17:30:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "Ana-c-ng",
    "error": "Could not fetch GitHub repository",
    "lcname": "likelycause2"
}
        
Elapsed time: 0.15542s