From c7b43ee0f6abf186ebec818874de76f21148e4bf Mon Sep 17 00:00:00 2001 From: saharmehrpour Date: Thu, 2 Nov 2023 13:49:00 -0400 Subject: [PATCH] change the order of mining rules algorithm --- src/initialState.js | 2 +- src/miningRulesCore/featureConfig.js | 24 ++++++++++++------------ src/miningRulesCore/postProcessing.js | 22 +++++++++++----------- src/reducers.js | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/initialState.js b/src/initialState.js index 74e0154..f719d11 100644 --- a/src/initialState.js +++ b/src/initialState.js @@ -718,7 +718,7 @@ export const initial_state = { recentSearches: [], recentVisitedElements: [] }, - selectedAlgorithm: allAlgorithms.FP_MAX_DEFAULT, + selectedAlgorithm: allAlgorithms.CHUI_MINER_DEFAULT, minedRules: [], minedRulePadState: { diff --git a/src/miningRulesCore/featureConfig.js b/src/miningRulesCore/featureConfig.js index c25c8e8..cced173 100644 --- a/src/miningRulesCore/featureConfig.js +++ b/src/miningRulesCore/featureConfig.js @@ -30,6 +30,18 @@ export const weightUpdateFactors = { * @type {Object} */ export const allAlgorithms = { + CHUI_MINER_DEFAULT: { + key: "CHUI-Miner", + parameters: [1000] + }, + CHUI_MINER_RELAXED: { + key: "CHUI-Miner", + parameters: [500] + }, + CHUI_MINER_MAX: { + key: "CHUI-MinerMax", + parameters: [400] + }, FP_MAX_DEFAULT: { key: "FPMax", parameters: [0.005] @@ -45,18 +57,6 @@ export const allAlgorithms = { FP_CLOSE: { // Extracts many FIQs key: "FPClose", parameters: [0.02] - }, - CHUI_MINER_DEFAULT: { - key: "CHUI-Miner", - parameters: [1000] - }, - CHUI_MINER_RELAXED: { - key: "CHUI-Miner", - parameters: [500] - }, - CHUI_MINER_MAX: { - key: "CHUI-MinerMax", - parameters: [400] } } diff --git a/src/miningRulesCore/postProcessing.js b/src/miningRulesCore/postProcessing.js index f6e07ea..5930e30 100644 --- a/src/miningRulesCore/postProcessing.js +++ b/src/miningRulesCore/postProcessing.js @@ -485,6 +485,17 @@ export const findFileFoldersForItemSet = (maxUtilityItemSet, fileGroup, * @return {{parameters: number[], key: string}|null} */ export const switchAlgorithm = (algorithm) => { + if (algorithm.key === allAlgorithms.CHUI_MINER_DEFAULT.key) { + if (algorithm.parameters[0] === allAlgorithms.CHUI_MINER_DEFAULT.parameters[0]) { + return allAlgorithms.CHUI_MINER_RELAXED; + } + if (algorithm.parameters[0] === allAlgorithms.CHUI_MINER_RELAXED.parameters[0]) { + return allAlgorithms.CHUI_MINER_MAX; + } + } + if (algorithm.key === allAlgorithms.CHUI_MINER_MAX.key) { + return allAlgorithms.FP_MAX_DEFAULT; + } if (algorithm.key === allAlgorithms.FP_MAX_DEFAULT.key) { if (algorithm.parameters[0] === allAlgorithms.FP_MAX_DEFAULT.parameters[0]) { return allAlgorithms.FP_MAX_RELAXED; @@ -496,16 +507,5 @@ export const switchAlgorithm = (algorithm) => { return allAlgorithms.FP_CLOSE; } } - if (algorithm.key === allAlgorithms.FP_CLOSE.key) { - return allAlgorithms.CHUI_MINER_DEFAULT; - } - if (algorithm.key === allAlgorithms.CHUI_MINER_DEFAULT.key) { - if (algorithm.parameters[0] === allAlgorithms.CHUI_MINER_DEFAULT.parameters[0]) { - return allAlgorithms.CHUI_MINER_RELAXED; - } - if (algorithm.parameters[0] === allAlgorithms.CHUI_MINER_RELAXED.parameters[0]) { - return allAlgorithms.CHUI_MINER_MAX; - } - } return null; } \ No newline at end of file diff --git a/src/reducers.js b/src/reducers.js index 356e215..0b61635 100644 --- a/src/reducers.js +++ b/src/reducers.js @@ -531,7 +531,7 @@ const reducer = (state = JSON.parse(JSON.stringify(initial_state)), action) => { minedRulesState: { ...state.minedRulesState, focusedElementData: action.data["focusedElementData"], - selectedAlgorithm: allAlgorithms.FP_MAX_DEFAULT, // reset the algorithm + selectedAlgorithm: allAlgorithms.CHUI_MINER_DEFAULT, // reset the algorithm minedRulePadState: { ...state.minedRulesState.minedRulePadState }