Problem with jagged arrays RRS feed

  • Question

  • Dear everyone

    I have some troubles with jagged arrays.

    I have defined the following Observed jagged array:

    //Some used constant

    int numRBPs = RBPs; Variable<int> numObservations = Variable.Observed(tmpGene.Length).Named("numObservations"); // some used ranges Range RBP = new Range(numRBPs).Named("RBP");

    //Define SI Ranges int[] sizes = new int[numRBPs]; string[] RBPsList = new string[numRBPs]; LoadSizes(out sizes,out RBPsList, numGenes); Range SI = new Range(sizes.Length).Named("SI"); VariableArray<int> sizesVar = Variable.Constant(sizes, RBP).Named("sizes"); Range feature = new Range(sizesVar[RBP]).Named("feature"); var geneSI = Variable.Array(Variable.Array(Variable.Array<double>(feature), gene),RBP).Named("GeneSI"); LoadGeneSI(geneSI, numGenes, numRBPs, sizes, RBPsList, RBPsMap, genesMap); geneSI.IsReadOnly = false;

    Then i have defined another jagged array of random variables:

    var geneLatentSI = Variable.Array(Variable.Array<double>(feature), RBP);

    The problems comes in the inference step. There I have to make the inner product and i would like to use the operator engine.Compiler.GivePriorityTo(typeof(GaussianProductOp_SHG09)) as in the recommender system example.

    Making the following operation:

    VariableArray<double> SIproducts = Variable.Array<double>(feature);
    SIproducts[feature] = geneSI[RBPData[observation]][geneData[observation]][feature] * 

    That is i have to make the product between each elements of two specific vectors of the observed jagged array "geneSI" and the jagged array of random variables "geneLatentSI". The elements of these arrays are indexed, as part of a jagged array, with "feature" RangeHowever that is idexed itself by RBP range. Since i want to access to each single elements as in the recommender system example

    products[trait] = RBPTraits[RBPData[observation]][trait] * geneTraits[geneData[observation]][trait];

    How can I make it works also for jagged arrays??

    Thanks a lot 


    Sunday, August 18, 2013 1:46 PM


All replies