Skip to content

Commit

Permalink
change the order of mining rules algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
saharmehrpour committed Nov 2, 2023
1 parent c967a29 commit c7b43ee
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/initialState.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ export const initial_state = {
recentSearches: [],
recentVisitedElements: []
},
selectedAlgorithm: allAlgorithms.FP_MAX_DEFAULT,
selectedAlgorithm: allAlgorithms.CHUI_MINER_DEFAULT,
minedRules: [],

minedRulePadState: {
Expand Down
24 changes: 12 additions & 12 deletions src/miningRulesCore/featureConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ export const weightUpdateFactors = {
* @type {Object<String, {parameters: number[], key: string}>}
*/
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]
Expand All @@ -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]
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/miningRulesCore/postProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion src/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c7b43ee

Please sign in to comment.