how to write code for given algorithm

Input:
train_data(d1,d2.dm) //training document vectors
with n features
test_data(d1,d2dk) // testing document vectors p
features
Output:
sim_matrix // Similarity matrix
Steps:
  1. [m,n]= size of train_data
  2. [k,p]= size of test_data
  3. Take Lamda=1 and sigma(1:n) =2
  4. Take N*D=0 and NuD=0
  5. for each document in test data and for each documentin training data
  6. if test_data[r,j] . train_data[i,j]>0
  7. then n1=0.5*(1+exp(-((train_data[r,j]-test_data[i,j])/sigma[j])^2))
  8. if test_data[I,j] and train_data[r,j]=0
  9. then n1=0
  10. otherwise n1=-lamda
  11. end if
  12. N*D[i,r]=N*D[i,r]+n1[r,j]
  13. end for
  14. for each feature in train data
  15. if train_data[r,j] and test[i,j]=0
  16. then n2=0
  17. otherwise n2=1
  18. end if
  19. NuD[i,r]=NuD[i,r]+n2[r,j]
  20. end loop

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Tags

No tags entered yet.

Asked:

on 3 Jan 2017

Answered:

on 3 Jan 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!