4
$\begingroup$

I derived a mathematical model for a porous system and the final function looks like this an equation of susceptibility as a function of porosity,

after going through the Mercers Theorem and its condition for a kernel I would love to write an SVM kernel with this equation on python and use it for predictions, please can someone help me with resources that can assist me in going about this or the equations python code as a kernel.

$\endgroup$

1 Answer 1

1
$\begingroup$

To use a mathematical equation as an SVM kernel in Python, you will need to use a machine learning library that supports custom kernel functions, such as scikit-learn. To use your equation as a kernel, you will need to define a custom kernel function that takes in two data points and returns the similarity between them, based on your equation. You can then use this custom kernel function when training your SVM model.

Here is an example of how you might define a custom kernel function in Python using your equation:

Create a custom kernel function that uses the susceptibility equation

def susceptibility_kernel(X, y):
  # Define your equation here
  return similarity

Create an SVM model using the custom kernel & Fit the model to your data and make predictions

# Use the custom kernel function when training your SVM model
svm = SVC(kernel=susceptibility_kernel)
svm.fit(X, y)

For more information and examples of implementing custom kernels in scikit-learn, you can refer to the official documentation:

You can also refer to other online resources and tutorials for implementing SVM models in Python, such as this one: Support Vector Machine

$\endgroup$
1
  • 1
    $\begingroup$ Finally, after three years. I`m so so grateful $\endgroup$ Dec 7, 2022 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.