Buggy code:
public final class RecommenderJob extends AbstractJob { public static final String BOOLEAN_DATA = "booleanData" ; private static final int DEFAULT_MAX_SIMILARITIES_PER_ITEM = 100 ; private static final int DEFAULT_MAX_COOCCURRENCES_PER_ITEM = 100 ; private static final int DEFAULT_MIN_PREFS_PER_USER = 1 ; @ Override public int run ( String [ ] args ) throws IOException , ClassNotFoundException , InterruptedException { addInputOption ( ) ; addOutputOption ( ) ; addOption ( "numRecommendations" , "n" , "Number<seq2seq4repair_space>of<seq2seq4repair_space>recommendations<seq2seq4repair_space>per<seq2seq4repair_space>user" , String . valueOf ( DEFAULT_NUM_RECOMMENDATIONS ) ) ; addOption ( "usersFile" , "u" , "File<seq2seq4repair_space>of<seq2seq4repair_space>users<seq2seq4repair_space>to<seq2seq4repair_space>recommend<seq2seq4repair_space>for" , null ) ; addOption ( "itemsFile" , "i" , "File<seq2seq4repair_space>of<seq2seq4repair_space>items<seq2seq4repair_space>to<seq2seq4repair_space>recommend<seq2seq4repair_space>for" , null ) ; addOption ( "filterFile" , "f" , ( "File<seq2seq4repair_space>containing<seq2seq4repair_space>comma-separated<seq2seq4repair_space>userID,itemID<seq2seq4repair_space>pairs.<seq2seq4repair_space>Used<seq2seq4repair_space>to<seq2seq4repair_space>exclude<seq2seq4repair_space>the<seq2seq4repair_space>item<seq2seq4repair_space>from<seq2seq4repair_space>" + "the<seq2seq4repair_space>recommendations<seq2seq4repair_space>for<seq2seq4repair_space>that<seq2seq4repair_space>user<seq2seq4repair_space>(optional)" ) , null ) ; addOption ( "booleanData" , "b" , "Treat<seq2seq4repair_space>input<seq2seq4repair_space>as<seq2seq4repair_space>without<seq2seq4repair_space>pref<seq2seq4repair_space>values" , Boolean . FALSE . toString ( ) ) ; <START_BUG> addOption ( "maxPrefsPerUser" , "mp" , "Maximum<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>preferences<seq2seq4repair_space>considered<seq2seq4repair_space>per<seq2seq4repair_space>user<seq2seq4repair_space>in<seq2seq4repair_space>final<seq2seq4repair_space>recommendation<seq2seq4repair_space>phase" , String . valueOf ( DEFAULT_MAX_PREFS_PER_USER_CONSIDERED ) ) ; <END_BUG> addOption ( "minPrefsPerUser" , "mp" , ( ( ( "ignore<seq2seq4repair_space>users<seq2seq4repair_space>with<seq2seq4repair_space>less<seq2seq4repair_space>preferences<seq2seq4repair_space>than<seq2seq4repair_space>this<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>similarity<seq2seq4repair_space>computation<seq2seq4repair_space>" + "(default:<seq2seq4repair_space>" ) + ( RecommenderJob . DEFAULT_MIN_PREFS_PER_USER ) ) + ')' ) , String . valueOf ( RecommenderJob . DEFAULT_MIN_PREFS_PER_USER ) ) ; addOption ( "maxSimilaritiesPerItem" , "m" , "Maximum<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>similarities<seq2seq4repair_space>considered<seq2seq4repair_space>per<seq2seq4repair_space>item<seq2seq4repair_space>" , String . valueOf ( RecommenderJob . DEFAULT_MAX_SIMILARITIES_PER_ITEM ) ) ; addOption ( "maxCooccurrencesPerItem" , "mo" , ( ( ( "try<seq2seq4repair_space>to<seq2seq4repair_space>cap<seq2seq4repair_space>the<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>cooccurrences<seq2seq4repair_space>per<seq2seq4repair_space>item<seq2seq4repair_space>to<seq2seq4repair_space>this<seq2seq4repair_space>" + "number<seq2seq4repair_space>(default:<seq2seq4repair_space>" ) + ( RecommenderJob . DEFAULT_MAX_COOCCURRENCES_PER_ITEM ) ) + ')' ) , String . valueOf ( RecommenderJob . DEFAULT_MAX_COOCCURRENCES_PER_ITEM ) ) ; addOption ( "similarityClassname" , "s" , ( ( ( "Name<seq2seq4repair_space>of<seq2seq4repair_space>distributed<seq2seq4repair_space>similarity<seq2seq4repair_space>class<seq2seq4repair_space>to<seq2seq4repair_space>instantiate,<seq2seq4repair_space>alternatively<seq2seq4repair_space>use<seq2seq4repair_space>" + "one<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>predefined<seq2seq4repair_space>similarities<seq2seq4repair_space>(" ) + ( SimilarityType . listEnumNames ( ) ) ) + ')' ) , String . valueOf ( SIMILARITY_COOCCURRENCE ) ) ; Map < String , String > parsedArgs = parseArguments ( args ) ; if ( parsedArgs == null ) { return - 1 ; } Path inputPath = getInputPath ( ) ; Path outputPath = getOutputPath ( ) ; int numRecommendations = Integer . parseInt ( parsedArgs . get ( "--numRecommendations" ) ) ; String usersFile = parsedArgs . get ( "--usersFile" ) ; String itemsFile = parsedArgs . get ( "--itemsFile" ) ; String filterFile = parsedArgs . get ( "--filterFile" ) ; boolean booleanData = Boolean . valueOf ( parsedArgs . get ( "--booleanData" ) ) ; int maxPrefsPerUser = Integer . parseInt ( parsedArgs . get ( "--maxPrefsPerUser" ) ) ; int minPrefsPerUser = Integer . parseInt ( parsedArgs . get ( "--minPrefsPerUser" ) ) ; int maxSimilaritiesPerItem = Integer . parseInt ( parsedArgs . get ( "--maxSimilaritiesPerItem" ) ) ; int maxCooccurrencesPerItem = Integer . parseInt ( parsedArgs . get ( "--maxCooccurrencesPerItem" ) ) ; String similarityClassname = parsedArgs . get ( "--similarityClassname" ) ; Path userVectorPath = getTempPath ( "userVectors" ) ; Path itemIDIndexPath = getTempPath ( "itemIDIndex" ) ; Path countUsersPath = getTempPath ( "countUsers" ) ; Path itemUserMatrixPath = getTempPath ( "itemUserMatrix" ) ; Path similarityMatrixPath = getTempPath ( "similarityMatrix" ) ; Path prePartialMultiplyPath1 = getTempPath ( "prePartialMultiply1" ) ; Path prePartialMultiplyPath2 = getTempPath ( "prePartialMultiply2" ) ; Path explicitFilterPath = getTempPath ( "explicitFilterPath" ) ; Path partialMultiplyPath = getTempPath ( "partialMultiply" ) ; AtomicInteger currentPhase = new AtomicInteger ( ) ; if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { Job itemIDIndex = prepareJob ( inputPath , itemIDIndexPath , TextInputFormat . class , ItemIDIndexMapper . class , VarIntWritable . class , VarLongWritable . class , ItemIDIndexReducer . class , VarIntWritable . class , VarLongWritable . class , SequenceFileOutputFormat . class ) ; itemIDIndex . setCombinerClass ( ItemIDIndexReducer . class ) ; itemIDIndex . waitForCompletion ( true ) ; } int numberOfUsers = 0 ; if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { Job toUserVector = prepareJob ( inputPath , userVectorPath , TextInputFormat . class , ToItemPrefsMapper . class , VarLongWritable . class , ( booleanData ? VarLongWritable . class : EntityPrefWritable . class ) , ToUserVectorReducer . class , VarLongWritable . class , VectorWritable . class , SequenceFileOutputFormat . class ) ; toUserVector . getConfiguration ( ) . setBoolean ( RecommenderJob . BOOLEAN_DATA , booleanData ) ; toUserVector . getConfiguration ( ) . setInt ( MIN_PREFERENCES_PER_USER , minPrefsPerUser ) ; toUserVector . waitForCompletion ( true ) ; numberOfUsers = ( ( int ) ( toUserVector . getCounters ( ) . findCounter ( USERS ) . getValue ( ) ) ) ; } if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { Job maybePruneAndTransponse = prepareJob ( userVectorPath , itemUserMatrixPath , SequenceFileInputFormat . class , MaybePruneRowsMapper . class , IntWritable . class , MatrixEntryWritable . class , ToItemVectorsReducer . class , IntWritable . class , VectorWritable . class , SequenceFileOutputFormat . class ) ; maybePruneAndTransponse . getConfiguration ( ) . setInt ( MAX_COOCCURRENCES , maxCooccurrencesPerItem ) ; maybePruneAndTransponse . waitForCompletion ( true ) ; } if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { try { ToolRunner . run ( getConf ( ) , new RowSimilarityJob ( ) , new String [ ] { "-Dmapred.input.dir=" + itemUserMatrixPath , "-Dmapred.output.dir=" + similarityMatrixPath , "--numberOfColumns" , String . valueOf ( numberOfUsers ) , "--similarityClassname" , similarityClassname , "--maxSimilaritiesPerRow" , String . valueOf ( ( maxSimilaritiesPerItem + 1 ) ) , "--tempDir" , getTempPath ( ) . toString ( ) } ) ; } catch ( Exception e ) { throw new IllegalStateException ( "item-item-similarity<seq2seq4repair_space>computation<seq2seq4repair_space>failed" , e ) ; } } if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { Job prePartialMultiply1 = prepareJob ( similarityMatrixPath , prePartialMultiplyPath1 , SequenceFileInputFormat . class , SimilarityMatrixRowWrapperMapper . class , VarIntWritable . class , VectorOrPrefWritable . class , Reducer . class , VarIntWritable . class , VectorOrPrefWritable . class , SequenceFileOutputFormat . class ) ; prePartialMultiply1 . waitForCompletion ( true ) ; Job prePartialMultiply2 = prepareJob ( userVectorPath , prePartialMultiplyPath2 , SequenceFileInputFormat . class , UserVectorSplitterMapper . class , VarIntWritable . class , VectorOrPrefWritable . class , Reducer . class , VarIntWritable . class , VectorOrPrefWritable . class , SequenceFileOutputFormat . class ) ;

Fix:
addOption ( "maxPrefsPerUser" , "mxp" , "Maximum<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>preferences<seq2seq4repair_space>considered<seq2seq4repair_space>per<seq2seq4repair_space>user<seq2seq4repair_space>in<seq2seq4repair_space>final<seq2seq4repair_space>recommendation<seq2seq4repair_space>phase" , String . valueOf ( DEFAULT_MAX_PREFS_PER_USER_CONSIDERED ) ) ;