#numVectors = len(lsaData.pz) numVectors = 2 lsaVector.append(lsaData.pwz[:, 3]) lsaVector.append(lsaData.pwz[:, 4]) #Stip down to the optimal number } #for i in range (0, numVectors): # lsaVector.append(lsaData.pwz[:, index[i]]) #lsaVector.append(lsaData.pwz[:, i]) projections = [] for v in lsaVector: projections.append([]) for d in dVector: projections[-1].append(analysis.lsaProjection(d, v)) pr = [] for s in range(len(projections[0])): tmp = [] for r in range(len(projections)): tmp.append(projections[r][s]) pr.append(tmp) pointsPlot = [[] for i in range(2)] numtosplit = 20 dim = 2 for s in range(len(times)): spot = int(s / numtosplit) pointsPlot[spot].append((pr[s][0:dim], str(times[s])))
#if len(tmpDoc) >= minBehaviour: dVector.append(tmpDoc) times.append(oldSplit) oldSplit = newSplit #Load plsa data lsaData = dataio.loadData(lsaLocation) #Take counts data and lsa data to make graph. index = [ i for (i,j) in sorted(enumerate(lsaData.pz), key=operator.itemgetter(1))] #numVectors = len(lsaData.pz) numVectors = 2 lsaVector.append(lsaData.pwz[:, 0]) lsaVector.append(lsaData.pwz[:, 3]) projections = [] for v in lsaVector: projections.append([]) for d in dVector: projections[-1].append(analysis.lsaProjection(d, v)) x = range(splitLength, numSplits + splitLength) x *= skipLength visualizer.plotLines(x, projections)
print tmpDoc lsaVector = [] index = [ i for ( i, j) in sorted(enumerate(lsaData.pz), key=operator.itemgetter(1)) ] #Stip down to the optimal number for i in range(numVectors): lsaVector.append(lsaData.pwz[:, index[i]]) ranges = [[(0, 1)], [(0, 1)]] for t in range(len(lsaVector)): #Now project this document to each latent class and store the results val = analysis.lsaProjection(tmpDoc, lsaVector[t]) yProj[t].append(val) ct += slide xProj.append(count) count += 1 xProj = numpy.array(xProj) visualizer.makeLatentTimeGraph(xProj, yProj, ranges)
print tmpDoc lsaVector = [] index = [ i for (i,j) in sorted(enumerate(lsaData.pz), key=operator.itemgetter(1))] #Stip down to the optimal number for i in range (numVectors): lsaVector.append(lsaData.pwz[:, index[i]]) ranges = [[(0, 1)], [(0, 1)]] for t in range(len(lsaVector)): #Now project this document to each latent class and store the results val = analysis.lsaProjection(tmpDoc, lsaVector[t]) yProj[t].append(val) ct += slide xProj.append(count) count += 1 xProj = numpy.array(xProj) visualizer.makeLatentTimeGraph(xProj, yProj, ranges)