Skip to main content

Posts

Related posts

Hyperparameter tuning of Support Vector Machine in MATLAB

  Let's create a code for hyper parameter optimization of SVM classifier using Harris hawks optimization algorithm. What is Hyperparameter Optimization? As the name indicates, hyperparameter optimization means, optimal selection of SVM parameters. Harris Hawks algorithm is adapted to optimally choose the SVM parameters like kernel functions and box constraints. Fitness function The fitness function is the minimization of classification error. Our objective is to find the best parameter setting with minimum classification error. function [ err , svmModel ] = fitness_fun ( p ) global traindata trainlabel valdata vallabela kernel = { ' gaussian ' , ' polynomial ' , ' linear ' }; op1 = kernel{ round ( p ( 1 ))}; kernelScale = round ( p ( 2 )); boxx = round ( p ( 3 )); svmModel = fitcsvm ( traindata , trainlabel , ...              ' BoxConstraint ' , boxx , ...              ' KernelFunction ' , op1 , ...              ' KernelScale

Latest posts

What is PV array reconfiguration

Advantages of using matlab

Matlab code for Remora Optimization algorithm

Matlab code for Bear Smell Search Optimization

Matlab code for Flamingo Optimization

Python code for COOT Optimization