Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cum_transform_feature Docstrings #494

Merged
merged 6 commits into from Apr 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 69 additions & 10 deletions featuretools/primitives/standard/cum_transform_feature.py
Expand Up @@ -5,8 +5,20 @@


class CumSum(TransformPrimitive):
"""Returns the cumulative sum after grouping"""

"""Calculates the cumulative sum.

Description:
Given a list of values, return the cumulative sum
(or running total). There is no set window, so the
sum at each point is calculated over all prior values.
`NaN` values will return `NaN`, but in the window of a
cumulative caluclation, they're ignored.

Examples:
>>> cum_sum = CumSum()
>>> cum_sum([1, 2, 3, 4, None, 5]).tolist()
[1.0, 3.0, 6.0, 10.0, nan, 15.0]
"""
name = "cum_sum"
input_types = [Numeric]
return_type = Numeric
Expand All @@ -20,8 +32,19 @@ def cum_sum(values):


class CumCount(TransformPrimitive):
"""Returns the cumulative count after grouping"""

"""Calculates the cumulative count.

Description:
Given a list of values, return the cumulative count
(or running count). There is no set window, so the
count at each point is calculated over all prior
values. `NaN` values are counted.

Examples:
>>> cum_count = CumCount()
>>> cum_count([1, 2, 3, 4, None, 5]).tolist()
[1, 2, 3, 4, 5, 6]
"""
name = "cum_count"
input_types = [[Id], [Discrete]]
return_type = Numeric
Expand All @@ -35,8 +58,20 @@ def cum_count(values):


class CumMean(TransformPrimitive):
"""Returns the cumulative mean after grouping"""

"""Calculates the cumulative mean.

Description:
Given a list of values, return the cumulative mean
(or running mean). There is no set window, so the
mean at each point is calculated over all prior values.
`NaN` values will return `NaN`, but in the window of a
cumulative caluclation, they're treated as 0.

Examples:
>>> cum_mean = CumMean()
>>> cum_mean([1, 2, 3, 4, None, 5]).tolist()
[1.0, 1.5, 2.0, 2.5, nan, 2.5]
"""
name = "cum_mean"
input_types = [Numeric]
return_type = Numeric
Expand All @@ -50,8 +85,20 @@ def cum_mean(values):


class CumMin(TransformPrimitive):
"""Returns the cumulative min after grouping"""

"""Calculates the cumulative minimum.

Description:
Given a list of values, return the cumulative min
(or running min). There is no set window, so the min
at each point is calculated over all prior values.
`NaN` values will return `NaN`, but in the window of a
cumulative caluclation, they're ignored.

Examples:
>>> cum_min = CumMin()
>>> cum_min([1, 2, -3, 4, None, 5]).tolist()
[1.0, 1.0, -3.0, -3.0, nan, -3.0]
"""
name = "cum_min"
input_types = [Numeric]
return_type = Numeric
Expand All @@ -65,8 +112,20 @@ def cum_min(values):


class CumMax(TransformPrimitive):
"""Returns the cumulative max after grouping"""

"""Calculates the cumulative maximum.

Description:
Given a list of values, return the cumulative max
(or running max). There is no set window, so the max
at each point is calculated over all prior values.
`NaN` values will return `NaN`, but in the window of a
cumulative caluclation, they're ignored.

Examples:
>>> cum_max = CumMax()
>>> cum_max([1, 2, 3, 4, None, 5]).tolist()
[1.0, 2.0, 3.0, 4.0, nan, 5.0]
"""
name = "cum_max"
input_types = [Numeric]
return_type = Numeric
Expand Down