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
require(caret) | |
#load some data | |
data(USArrests) | |
### Prepare Data (postive observations) | |
# add a column to be the strata. In this case it is states, it can be sites, or other locations | |
# the original data has 50 rows, so this adds a state label to 10 consecutive observations | |
USArrests$state <- c(rep(c("PA","MD","DE","NY","NJ"), each = 5)) | |
# this replaces the existing rownames (states) with a simple numerical index |
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
#!/usr/bin/env python | |
from fitparse import FitFile | |
import srtm | |
import xml.dom.minidom as minidom | |
import moment | |
import sys | |
import xml.etree.cElementTree as ET |
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
from __future__ import division | |
import numpy as np | |
from numpy.lib.stride_tricks import as_strided as ast | |
def chunk_data(data,window_size,overlap_size=0,flatten_inside_window=True): | |
assert data.ndim == 1 or data.ndim == 2 | |
if data.ndim == 1: | |
data = data.reshape((-1,1)) | |
# get the number of overlapping windows that fit into the data |