Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 581:10e8a9f2bd9f
change for python 2.6
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 17 Sep 2014 17:29:19 -0400 |
parents | 05c927c6d3cf |
children | 7e1ae4d97f1a |
comparison
equal
deleted
inserted
replaced
580:1262faae12e7 | 581:10e8a9f2bd9f |
---|---|
1174 return 1 | 1174 return 1 |
1175 else: | 1175 else: |
1176 return x''' | 1176 return x''' |
1177 if not hasattr(self, aggregatedSpeed): | 1177 if not hasattr(self, aggregatedSpeed): |
1178 self.aggregatedSpeed = aggregationFunc(self.getSpeeds()) | 1178 self.aggregatedSpeed = aggregationFunc(self.getSpeeds()) |
1179 userTypeProbabilities = {userType2Num[userTypename]: speedProbabilities[userTypename](self.aggregatedSpeed) for userTypename in speedProbabilities} | 1179 userTypeProbabilities = {} |
1180 for userTypename in speedProbabilities: | |
1181 userTypeProbabilities[userType2Num[userTypename]] = speedProbabilities[userTypename](self.aggregatedSpeed) | |
1180 self.setUserType(utils.argmaxDict(userTypeProbabilities)) | 1182 self.setUserType(utils.argmaxDict(userTypeProbabilities)) |
1181 return userTypeProbabilities | 1183 return userTypeProbabilities |
1182 | 1184 |
1183 def initClassifyUserTypeHoGSVM(self, aggregationFunc = median): | 1185 def initClassifyUserTypeHoGSVM(self, aggregationFunc = median): |
1184 '''Initializes the data structures for classification | 1186 '''Initializes the data structures for classification |