@@ -74,27 +74,27 @@ export default function OptimizeMLModelWithEA() {
7474
7575 const router = useRouter ( ) ;
7676
77- const runGPAlgorithm = async ( ) => {
77+ const runEAMLAlgo = async ( ) => {
7878 const inputData = {
79- algorithm : chosenAlgo ,
80- mlEvalFunctionCodeString : mlEvalFunctionCodeString ,
81- populationSize : populationSize ,
82- generations : generations ,
83- cxpb : cxpb ,
84- mutpb : mutpb ,
85- weights : parameters ,
86- googleDriveUrl : datasetURL ,
87- sep : sep ,
88- mlImportCodeString : mlImportCodeString ,
89- targetColumnName : targetColumnName ,
79+ algorithm : chosenAlgo . toString ( ) ,
80+ mlEvalFunctionCodeString : mlEvalFunctionCodeString . toString ( ) ,
81+ populationSize : parseInt ( populationSize ) ,
82+ generations : parseInt ( generations . toString ( ) ) ,
83+ cxpb : parseFloat ( cxpb ) ,
84+ mutpb : parseFloat ( mutpb ) ,
85+ weights : parameters . map ( ( param ) => parseFloat ( param ) ) ,
86+ googleDriveUrl : datasetURL . toString ( ) ,
87+ sep : sep . toString ( ) ,
88+ mlImportCodeString : mlImportCodeString . toString ( ) ,
89+ targetColumnName : targetColumnName . toString ( ) ,
9090 indpb : 0.05 ,
91- crossoverFunction : matingFunc ,
92- mutationFunction : mutateFunc ,
93- selectionFunction : selectFunc ,
94- tournamentSize : tempTourSize ,
95- mu : mu ,
96- lambda_ : lambda ,
97- hofSize : hof ,
91+ crossoverFunction : matingFunc . toString ( ) ,
92+ mutationFunction : mutateFunc . toString ( ) ,
93+ selectionFunction : selectFunc . toString ( ) ,
94+ tournamentSize : parseInt ( tempTourSize ) ,
95+ mu : parseInt ( mu ?? 2 ) ,
96+ lambda_ : parseInt ( lambda ?? 4 ) ,
97+ hofSize : parseInt ( hof ?? 5 ) ,
9898 } ;
9999
100100 const response = await fetch (
@@ -392,7 +392,7 @@ export default function OptimizeMLModelWithEA() {
392392 onClick = { ( e ) => {
393393 e . preventDefault ( ) ;
394394 setIsLoading ( true ) ;
395- runGPAlgorithm ( ) . then ( ( ) => {
395+ runEAMLAlgo ( ) . then ( ( ) => {
396396 setIsLoading ( false ) ;
397397 } ) ;
398398 } }
0 commit comments