Git Product home page Git Product logo

Comments (7)

raamana avatar raamana commented on June 2, 2024

Thank you @klingsly for the reporting the issue. I will respond to you shortly, with a solution/code.

from kernelmethods.

klingsly avatar klingsly commented on June 2, 2024

Thank you @klingsly for the reporting the issue. I will respond to you shortly, with a solution/code.

I am sorry to get back to you late.Your method is very useful to me. I hope you can solve my problem.Looking forward to your reply soon!

from kernelmethods.

raamana avatar raamana commented on June 2, 2024

Hi @klingsly , sorry for the delayed reply, but here it is:

Applying the kernel functions to test datasets requires an additional step of computing inner products between the test and train sample feature matrices, as illustrated below:

# create same kernel matrices as before
lin = KernelMatrix(LinearKernel())
rbf = KernelMatrix(GaussianKernel(sigma=10))
poly = KernelMatrix(PolyKernel(degree=2))
lap = KernelMatrix(LaplacianKernel(gamma=2))

test_kSet = KernelSet()
for km in [lin, rbf, poly, lap]:
    # notice that this is an inner product between test AND train sample feature matrices
    # this is required in kernel methods to make predictions
    km.attach_to(X_test, name_one='test_X', 
                 sample_two=X_train, name_two='train_X')
    test_kSet.append(km)

# compute the weighted linear combination
fused_test_X = linear_combination(test_kSet, weight_vec)

# now make predictions
mkl.predict(fused_test_X)

hope that helps? let me know if you have more questions.

we hope to release a MultipleKernelLearning() class soon, and would appreciate others contributing to it if they have the necessary skills and time. (see #9 )

from kernelmethods.

klingsly avatar klingsly commented on June 2, 2024

Thanks for your response. I have a problem with this solution about how to fit train datasets?

from kernelmethods.

raamana avatar raamana commented on June 2, 2024

What do you mean? You already did train the MKL with:

mkl.fit(X=X_train, y=y_train)

from kernelmethods.

klingsly avatar klingsly commented on June 2, 2024

Sorry, I misunderstood what you meant. It's OK now

from kernelmethods.

raamana avatar raamana commented on June 2, 2024

Great. please feel free to open another issue if you run into any issues.

from kernelmethods.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.