Permalink
Browse files

1. add reindex history

2. add group training part
3. revise the make basic feature part
  • Loading branch information...
1 parent 41da6a0 commit ecfe2191683b78d3b68977dbb0c016615730d1eb @Ykid Ykid committed Aug 1, 2013
Showing with 31 additions and 11 deletions.
  1. +4 −3 utils/Model.py
  2. +27 −8 utils/script.py
View
@@ -27,7 +27,7 @@ def __init__(self,configModel,utils,strTrial):
self.ImfeatTest = utils.MODEL_FEATURED_PATH + self.tag + \
'_Imtest' + '_t' + strTrial
- self.tmptrain = utils.MODEL_TMP_PATH + self.tag + \
+ self.tmpTrain = utils.MODEL_TMP_PATH + self.tag + \
'_train' + '_t' + strtrial
self.tmpCV = utils.MODEL_TMP_PATH + self.tag + \
'_CV' + '_t' + strTrial
@@ -39,6 +39,7 @@ def __init__(self,configModel,utils,strTrial):
self.tmpTest = utils.MODEL_TMP_PATH + self.tag + \
'_test'+ '_t' + strTrial
+ #for storing the line order of the group file
self.tmpLineOrder = utils.MODEL_TMP_PATH + self.tag + \
'_LineOrder' + '_t' + strTrial
@@ -58,9 +59,9 @@ def __init__(self,configModel,utils,strTrial):
self.movieTagPath = utils.MOVIE_TAG_PATH
self.userSocialPath = utils.USER_SOCIAL_PATH
self.userHistoryPath= utils.USER_HISTORY_PATH
- self.CVSet = True
self.userHistoryReindexPath= utils.MODEL_TMP_PATH + self.tag + \
- '_userHistoryReindex' + '_t' + strTrial
+ '_userHistoryReindex' + '_t' + strTrial
+ self.CVSet = True
def prependUserMovieToPredictions(self,idsPath,fixPath,savePath):
View
@@ -1,21 +1,40 @@
def setupImplicitFeatures(self):
- #translate the training files and build two dicts
+ import os
+ #reindex the training files and build two dicts
Udic,ItemDic,avg=reIndex_Implicit(self.bootTrain,self.tmpTrain)
- #translate CV file
+ #reindex the history
+ transalte(self.userHistoryPath, self.userHistoryReindexPath, Udic, ItemDic)
+ #reindex CV file
translate(self.bootCV, self.tmpCV, Udic, ItemDic)
- #translate Testfile
+ #reindex Testfile
translate(self.bootTest, self.tmpTest, Udic, ItemDic)
+ #make group training files
+ os.system(self.SVDFeatureLineReorder +' '+ self.tmpTrain + \
+ ' '+ self.tmpLineOrder)
+ os.system(self.SVDFeatureSVDPPRandOrder + ' ' + self.tmpTrain + \
+ ' ' + self.tmpLineOrder + ' ' + self.tmpGpTrain)
+
+ #make group training files of the CV set
+ os.system(self.SVDFeatureLineReorder +' '+ self.tmpCV + \
+ ' '+ self.tmpLineOrder)
+ os.system(self.SVDFeatureSVDPPRandOrder + ' ' + self.tmpCV + \
+ ' ' + self.tmpLineOrder + ' ' + self.tmpGpCV)
+
+ #make basic feature files
+ self.basicConvert(self.tmpGpTrain,self.featTrain)
+ self.basicConvert(self.tmpGpCV, self.featCV)
+ self.basicConvert(self.tmpTest, self.featTest)
+
+ #make implicit feature files
+
+
#set different parameters
- self.numUser=len(UDic)
+ self.numUser=len(Udic)
self.numMovie=len(ItemDic)
self.avg=avg
self.numGlobal = 0
- #make basic feature files
- self.basicConvert(self.tmpTrain,self.featTrain)
- self.basicConvert(self.tmpCV, self.featCV)
- self.basicConvert(self.tmpTest, self.featTest)
#make implicit feature files
#Here I need to issue two command

0 comments on commit ecfe219

Please sign in to comment.