Beispiel #1
0
def getLowDimensionalSegments(highDimensionalData,n_components=2,plt=False,title="Latent space segments"):
	(lowDimensionalData,explainedVariance) = pca.pca(highDimensionalData,n_components)
	(mins,maxs) = segment.segmentationPoints(lowDimensionalData[:,0])
	segments = pl.split(lowDimensionalData,maxs)[1:-1]
	if plt:
		plot.plotGridOf2Ds(segments,title)
	return (segments,explainedVariance)
Beispiel #2
0
	pylab.figure(figsize=(12,9))
	pylab.plot(d)
	pylab.xlabel('Time (frames)')
	pylab.ylabel('Sensor readings')
	pylab.title('Raw data',fontsize=50)
	pylab.tight_layout()
	pylab.savefig('/Users/robertevans/repos/minf/Appendix/%s.png'%n, format='png', dpi=300)

for d,n in zip(data,pcaNames):
	pylab.close()
	pylab.figure(figsize=(12,9))
	pylab.plot(pca.pca(d)[0])
	pylab.xlabel('Time (frames)')
	pylab.ylabel('Latent value')
	pylab.title('Three Principal Components',fontsize=50)
	pylab.tight_layout()
	pylab.savefig('/Users/robertevans/repos/minf/Appendix/%s.png'%n, format='png', dpi=300)

for d,n in zip(data,segsNames):
	pylab.close()
	P = pca.pca(d)[0][:,0]
	(mins,maxs) = segment.segmentationPoints(P, windowSize=100)
	pylab.figure(figsize=(12,9))
	pylab.plot(P)
	for m in maxs:
		pylab.axvline(m,color='r',linewidth=1.5)
	pylab.xlabel('Time (frames)')
	pylab.ylabel('Latent value')
	pylab.title('Automatic segmentation',fontsize=50)
	pylab.tight_layout()
	pylab.savefig('/Users/robertevans/repos/minf/Appendix/%s.png'%n, format='png', dpi=300)
Beispiel #3
0
def getQuaternionSegmentsByRawData(highDimensionalData,quaternionData):
	(lowDimensionalData,explainedVariance) = pca.pca(highDimensionalData,n_components=1)
	(mins,maxs) = segment.segmentationPoints(lowDimensionalData[:,0])
	segments = pl.split(quaternionData,maxs)[1:-1]
	return segments
Beispiel #4
0
def getHighAndLowDimSegments(highDimensionalData, n_components=3, smoothingWindow=100):
	(lowDimensionalData,explainedVariance) = pca.pca(highDimensionalData,n_components)
	(mins,maxs) = segment.segmentationPoints(lowDimensionalData[:,0], windowSize=smoothingWindow)
	HDsegments = pl.split(highDimensionalData,maxs)[1:-1]
	LDsegments = pl.split(lowDimensionalData,maxs)[1:-1]
	return (HDsegments,LDsegments,explainedVariance)