//constructor for karma public Karma(int setEpsilon, int setMaxGap, double setMinVerSup, string dsFilePath, bool setHS1, int entitieSizeLimit = KLC.NUM_OF_ENTITIES) { //set variables epsilon = setEpsilon; max_gap = setMaxGap; HS1 = setHS1; //read input KLC.read_tids_file(dsFilePath, ref entityTISs, ref Symbols); entitieSize = entityTISs.Count; min_ver_sup = ((double)setMinVerSup / 100) * entitieSize; entitiesVec = new int[entitieSize]; for (int eIdx = 0; eIdx < entitieSize; eIdx++) { entitiesVec[eIdx] = entityTISs.Keys.ElementAt(eIdx); } karma = new Tindex(entitieSize, relations_style); //load transition table KLC.LoadTransitionTableALLEN7(ref transition); RunKarma(entitieSizeLimit); }
// For Single KarmaLego public Dharma(int setMaxTirpSize, bool setFullDics, int dharmaIndexType, int frstEntIdx, int lstEntIdx, int setForBackWards, int setRelationStyle, int setEpsilon, int setMaxGap, string dsFilePath, bool runKarma, List <int> tonceptIds) { mxAccsCounter = 0; forBackWards = setForBackWards; relations_style = setRelationStyle; epsilon = setEpsilon; max_gap = setMaxGap; HS1 = false; maxTirpSize = setMaxTirpSize; KLC.read_tids_file(dsFilePath, ref entityTISs, ref toncepts); entitieSize = entityTISs.Count; min_ver_sup = 0; // ((double)setMinVerSup / 100) * entitieSize; entitiesVec = new int[entitieSize]; for (int eIdx = 0; eIdx < entitieSize; eIdx++) { entitiesVec[eIdx] = entityTISs.Keys.ElementAt(eIdx); } ////twoSizedTIRPsMatrix = new twoSizedTIRPsMATRIXEntry[KLC.NUM_OF_SYMBOLS][]; //initialize keys vector ////for (int i = 0; i < KLC.NUM_OF_SYMBOLS; i++) //// twoSizedTIRPsMatrix[i] = new twoSizedTIRPsMATRIXEntry[KLC.NUM_OF_SYMBOLS]; // initialize val vector //karma = new tindex(entitieSize, relations_style); dharmaIdx = new dharmaIndex(dharmaIndexType, entitieSize, relations_style);//, setFullDics); //print = setPrint; //trans = seTrans; if (trans) { KLC.LoadTransitionTableALLEN7(ref transition);//load transition table } if (forBackWards == KLC.backwardsMining) { logiRelsIndxs = new int[KLC.MAX_TIRP_TONCEPTS_SIZE][]; logiRelsIndxs[0 /*3*/] = new int[1] { 0 }; logiRelsIndxs[1 /*3*/] = new int[3] { 2, 1, 0 }; logiRelsIndxs[2 /*4*/] = new int[6] { 5, 4, 2, 3, 1, 0 }; logiRelsIndxs[3 /*5*/] = new int[10] { 9, 8, 5, 7, 4, 2, 6, 3, 1, 0 }; logiRelsIndxs[4 /*6*/] = new int[15] { 14, 13, 9, 12, 8, 5, 11, 7, 4, 2, 10, 6, 3, 1, 0 }; logiRelsIndxs[5 /*7*/] = new int[21] { 20, 19, 14, 18, 13, 9, 17, 12, 8, 5, 16, 11, 7, 4, 2, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[6 /*8*/] = new int[28] { 27, 26, 20, 25, 19, 14, 24, 18, 13, 9, 23, 17, 12, 8, 5, 22, 16, 11, 7, 4, 2, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[7 /*9*/] = new int[36] { 35, 34, 27, 33, 26, 20, 32, 25, 19, 14, 31, 24, 18, 13, 9, 30, 23, 17, 12, 8, 5, 29, 22, 16, 11, 7, 4, 2, 28, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[8 /*9*/] = new int[45] { 44, 43, 35, 42, 34, 27, 41, 33, 26, 20, 40, 32, 25, 19, 14, 39, 31, 24, 18, 13, 9, 38, 30, 23, 17, 12, 8, 5, 37, 29, 22, 16, 11, 7, 4, 2, 36, 28, 21, 15, 10, 6, 3, 1, 0 }; } if (runKarma == true) { RunKarmaRun(tonceptIds, frstEntIdx, lstEntIdx); } }
// For KarmaLego public Dharma(int setMaxTirpSize, bool setFulleDics, int dharmaIndexType, bool runKarma, int setForBackWards, int setRelationStyle, int setEpsilon, int setMaxGap, double setMinVerSup, string dsFilePath, bool seTrans, bool setHS1, int setPrint, ref string runTime, int entitieSizeLimit = KLC.NUM_OF_ENTITIES) { DateTime starTime = DateTime.Now; string timings = ""; mxAccsCounter = 0; forBackWards = setForBackWards; relations_style = setRelationStyle; epsilon = setEpsilon; max_gap = setMaxGap; HS1 = setHS1; maxTirpSize = setMaxTirpSize; KLC.read_tids_file(dsFilePath, ref entityTISs, ref toncepts); entitieSize = entityTISs.Count; min_ver_sup = ((double)setMinVerSup / 100) * entitieSize; entitiesVec = new int[entitieSize]; for (int eIdx = 0; eIdx < entitieSize; eIdx++) { entitiesVec[eIdx] = entityTISs.Keys.ElementAt(eIdx); } //twoSizedTIRPsMatrix = new twoSizedTIRPsMATRIXEntry[KLC.NUM_OF_SYMBOLS][]; //initialize keys vector //for (int i = 0; i < KLC.NUM_OF_SYMBOLS; i++) // twoSizedTIRPsMatrix[i] = new twoSizedTIRPsMATRIXEntry[KLC.NUM_OF_SYMBOLS]; // initialize val vector //twoSizedTIRPsMatrixWithPsik = new twoSizedTIRPsMATRIXEntry[KLC.NUM_OF_SYMBOLS, KLC.NUM_OF_SYMBOLS]; //karma = new tindex(entitieSize, relations_style); dharmaIdx = new dharmaIndex(dharmaIndexType, entitieSize, relations_style); //, setFulleDics); print = setPrint; trans = seTrans; if (trans) { KLC.LoadTransitionTableALLEN7(ref transition);//load transition table } if (forBackWards == KLC.backwardsMining) { logiRelsIndxs = new int[KLC.MAX_TIRP_TONCEPTS_SIZE][]; logiRelsIndxs[0 /*3*/] = new int[1] { 0 }; logiRelsIndxs[1 /*3*/] = new int[3] { 2, 1, 0 }; logiRelsIndxs[2 /*4*/] = new int[6] { 5, 4, 2, 3, 1, 0 }; logiRelsIndxs[3 /*5*/] = new int[10] { 9, 8, 5, 7, 4, 2, 6, 3, 1, 0 }; logiRelsIndxs[4 /*6*/] = new int[15] { 14, 13, 9, 12, 8, 5, 11, 7, 4, 2, 10, 6, 3, 1, 0 }; logiRelsIndxs[5 /*7*/] = new int[21] { 20, 19, 14, 18, 13, 9, 17, 12, 8, 5, 16, 11, 7, 4, 2, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[6 /*8*/] = new int[28] { 27, 26, 20, 25, 19, 14, 24, 18, 13, 9, 23, 17, 12, 8, 5, 22, 16, 11, 7, 4, 2, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[7 /*9*/] = new int[36] { 35, 34, 27, 33, 26, 20, 32, 25, 19, 14, 31, 24, 18, 13, 9, 30, 23, 17, 12, 8, 5, 29, 22, 16, 11, 7, 4, 2, 28, 21, 15, 10, 6, 3, 1, 0 }; logiRelsIndxs[8 /*9*/] = new int[45] { 44, 43, 35, 42, 34, 27, 41, 33, 26, 20, 40, 32, 25, 19, 14, 39, 31, 24, 18, 13, 9, 38, 30, 23, 17, 12, 8, 5, 37, 29, 22, 16, 11, 7, 4, 2, 36, 28, 21, 15, 10, 6, 3, 1, 0 }; } if (runKarma == true) { RunKarmaRun(null, 0, entitieSizeLimit); } DateTime endTime = DateTime.Now; runTime = endTime.Subtract(starTime).TotalMilliseconds.ToString(); // ((endTime - starTime).Minutes * 60 + (endTime - starTime).Seconds) + "," + (endTime - starTime).Minutes + ":" + (endTime - starTime).Seconds; }