how to write code for given algorithm
이전 댓글 표시
Input:
train_data(d1,d2….dm) //training document vectors
with n features
test_data(d1,d2…dk) // testing document vectors p
features
Output:
sim_matrix // Similarity matrix
Steps:
- [m,n]= size of train_data
- [k,p]= size of test_data
- Take Lamda=1 and sigma(1:n) =2
- Take N*D=0 and NuD=0
- for each document in test data and for each documentin training data
- if test_data[r,j] . train_data[i,j]>0
- then n1=0.5*(1+exp(-((train_data[r,j]-test_data[i,j])/sigma[j])^2))
- if test_data[I,j] and train_data[r,j]=0
- then n1=0
- otherwise n1=-lamda
- end if
- N*D[i,r]=N*D[i,r]+n1[r,j]
- end for
- for each feature in train data
- if train_data[r,j] and test[i,j]=0
- then n2=0
- otherwise n2=1
- end if
- NuD[i,r]=NuD[i,r]+n2[r,j]
- end loop
댓글 수: 1
Image Analyst
2017년 1월 3일
답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!