protected Context [ ] getParameters ( int [ ] [ ] outcomePatterns ) throws java . io . IOException { Context [ ] params = new Context [ NUM_PREDS ] ; int pid = 0 ; for ( int i = 0 ; i < outcomePatterns . length ; i ++ ) { //construct outcome pattern int [ ] outcomePattern = new int [ outcomePatterns [ i ] . length - 1 ] ; for ( int k = 1 ; k < outcomePatterns [ i ] . length ; k ++ ) { outcomePattern [ k - 1 ] = outcomePatterns [ i ] [ k ] ; } //populate parameters for each context which uses this outcome pattern. for ( int j = 0 ; j < outcomePatterns [ i ] [ 0 ] ; j ++ ) { double [ ] contextParameters = new double [ outcomePatterns [ i ] . length - 1 ] ; for ( int k = 1 ; k < outcomePatterns [ i ] . length ; k ++ ) { contextParameters [ k - 1 ] = readDouble ( ) ; } params [ pid ] = new Context ( outcomePattern , contextParameters ) ; pid ++ ; } } return params ; }
Reads the parameters from a file and populates an array of context objects .