-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* deprecate Split mixin * remove legacy * remove legacy
- Loading branch information
1 parent
f1b7b9b
commit 7419537
Showing
6 changed files
with
39 additions
and
41 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Split function.""" | ||
|
||
|
||
def split_series(X, n_intervals): | ||
"""Split a time series into approximately equal intervals. | ||
Adopted from = https://stackoverflow.com/questions/2130016/ | ||
splitting-a-list-into-n-parts-of-approximately | ||
-equal-length | ||
Parameters | ||
---------- | ||
X : a numpy array of shape = [n_timepoints] | ||
Returns | ||
------- | ||
output : a numpy array of shape = [self.n_intervals,interval_size] | ||
""" | ||
avg = len(X) / float(n_intervals) | ||
output = [] | ||
beginning = 0.0 | ||
|
||
while beginning < len(X): | ||
output.append(X[int(beginning) : int(beginning + avg)]) | ||
beginning += avg | ||
|
||
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters