Package edu.gsu.cs.dmlab.solgrind.algo
Class SequenceUtils
- java.lang.Object
-
- edu.gsu.cs.dmlab.solgrind.algo.SequenceUtils
-
public class SequenceUtils extends Object
- Author:
- Data Mining Lab, Georgia State University
-
-
Constructor Summary
Constructors Constructor Description SequenceUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Trajectory
createTailWindow(Instance ins, float tailRatio, double bufferDistance, long tailValidity, long samplingInterval)
Generates tail window from an instancestatic Trajectory
createTailWindow(Instance ins, long tailInterval, double bufferDistance, long tailValidity, long samplingInterval)
Generates tail window from an instancestatic TwoSequence
discoverFollowRelationship(InstanceData headData, Trajectory head, InstanceData tailData, Trajectory tailW, String ciType)
Given two instance trajectories in form of InstanceData objects and trajectories (head and tailWindow), method returns an TwoSequence (2-sequence) object, which describes a follow relationshipstatic Instance
generateHead(Instance ins, long headInterval)
Generates head segment using head interval strategy Gets the trajectory segment that covers initial 'headInterval' time interval.static Instance
generateHeadwithRatio(Instance ins, double headRatio)
Generates head segment using head ratio strategy Gets the trajectory segment that covers initial 'headRatio' amount of trajectory's lifespan.static Trajectory
generateTail(Instance ins, float tailRatio)
Generates tail segment using tail ratio strategy Gets the trajectory segment that covers last 'tailRatio' amount of trajectory's lifespan.static Trajectory
generateTail(Instance ins, long tailInterval)
Generates the tail segment using tail interval strategy Gets the trajectory segment that covers last 'tailInterval' time interval.static Trajectory
generateTailBuffer(Trajectory tail, double bufferDistance)
Generates tail buffer from a given tail segment of the trajectory using bufferDistance parameter.static Instance
generateTailWindow(Instance instance, long tailInterval, double bufferDistance, long tailValidityCount)
static Trajectory
generateTailWindow(Trajectory tailBuffer, long tailValidity, long samplingInterval)
Generates tail window using the buffered tail trajectory by propagating itstatic Instance
generateTailWindowWithRatio(Instance instance, double tailRatio, double bufferDistance, long tailValidityCount)
static Set<InstanceSequence>
instanceSequenceConnector(HashSet<InstanceSequence> instanceSequences, int desiredLength)
Gets a set of instance sequences (InstanceSequence objects), and connects them based on the equality of prefix and suffix (of possible followee and follower instance sequences)static Trajectory
sampleTGPairs(Trajectory traj, long samplingInterval)
Based on a sampling interval, sample the time-geometry pairs in the trajectory
-
-
-
Method Detail
-
generateHead
public static Instance generateHead(Instance ins, long headInterval)
Generates head segment using head interval strategy Gets the trajectory segment that covers initial 'headInterval' time interval.- Parameters:
ins
- - instance whose head is to be generatedheadInterval
- - head interval parameter- Returns:
- head segment of the instance which is a Trajectory object
-
generateHeadwithRatio
public static Instance generateHeadwithRatio(Instance ins, double headRatio)
Generates head segment using head ratio strategy Gets the trajectory segment that covers initial 'headRatio' amount of trajectory's lifespan.- Parameters:
ins
-headRatio
-- Returns:
-
generateTail
public static Trajectory generateTail(Instance ins, long tailInterval)
Generates the tail segment using tail interval strategy Gets the trajectory segment that covers last 'tailInterval' time interval.- Parameters:
ins
- - instance whose head is to be generatedtailInterval
- - tail interval parameter- Returns:
- tail segment of the trajectory
-
generateTail
public static Trajectory generateTail(Instance ins, float tailRatio)
Generates tail segment using tail ratio strategy Gets the trajectory segment that covers last 'tailRatio' amount of trajectory's lifespan.- Parameters:
ins
-tailRatio
-- Returns:
-
generateTailBuffer
public static Trajectory generateTailBuffer(Trajectory tail, double bufferDistance)
Generates tail buffer from a given tail segment of the trajectory using bufferDistance parameter. Simply applies a spatial buffer to all geometries- Parameters:
tail
- - tail trajectory segmentbufferDistance
- - buffer distance parameter- Returns:
-
generateTailWindow
public static Trajectory generateTailWindow(Trajectory tailBuffer, long tailValidity, long samplingInterval)
Generates tail window using the buffered tail trajectory by propagating it- Parameters:
tailBuffer
- - buffered tail trajectorytailValidity
- - the period that will be used to propagate the tgpairs in trajectorysamplingInterval
- - the sampling interval for creating a better tail window- Returns:
- - tail window trajectory
-
sampleTGPairs
public static Trajectory sampleTGPairs(Trajectory traj, long samplingInterval)
Based on a sampling interval, sample the time-geometry pairs in the trajectory- Parameters:
traj
-samplingInterval
-- Returns:
-
generateTailWindowWithRatio
public static Instance generateTailWindowWithRatio(Instance instance, double tailRatio, double bufferDistance, long tailValidityCount)
-
generateTailWindow
public static Instance generateTailWindow(Instance instance, long tailInterval, double bufferDistance, long tailValidityCount) throws org.locationtech.jts.io.ParseException
- Throws:
org.locationtech.jts.io.ParseException
-
createTailWindow
public static Trajectory createTailWindow(Instance ins, long tailInterval, double bufferDistance, long tailValidity, long samplingInterval)
Generates tail window from an instance- Parameters:
ins
-tailInterval
-bufferDistance
-tailValidity
-samplingInterval
-- Returns:
-
createTailWindow
public static Trajectory createTailWindow(Instance ins, float tailRatio, double bufferDistance, long tailValidity, long samplingInterval)
Generates tail window from an instance- Parameters:
ins
-tailRatio
-bufferDistance
-tailValidity
-samplingInterval
-- Returns:
-
discoverFollowRelationship
public static TwoSequence discoverFollowRelationship(InstanceData headData, Trajectory head, InstanceData tailData, Trajectory tailW, String ciType)
Given two instance trajectories in form of InstanceData objects and trajectories (head and tailWindow), method returns an TwoSequence (2-sequence) object, which describes a follow relationship- Parameters:
headData
- - the data for headhead
- - head segmenttailData
- - the data for tail windowtailW
- - tail window segmentciType
- - chain index type- Returns:
-
instanceSequenceConnector
public static Set<InstanceSequence> instanceSequenceConnector(HashSet<InstanceSequence> instanceSequences, int desiredLength)
Gets a set of instance sequences (InstanceSequence objects), and connects them based on the equality of prefix and suffix (of possible followee and follower instance sequences)- Parameters:
instanceSequences
- - set of instance sequences to be examineddesiredLength
- - the length of resulting instance sequences- Returns:
-
-