matlab convex optimization code giving incorrect answer
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
EDU>>f = fopen('myTextFile.txt','r')
#text file is of the form row1 col1 rating
# row2 col2 rating ...
EDU>>ln = textscan(f,'%f %f %f',inf,'Delimiter',{' '})
EDU>> myMatrix = sparse(vec(ln{1}),vec(ln{2}),vec(ln{3}),36473,4503);
EDU>>cvx_begin
EDU>> variable W(4503,1)
EDU>> minimize((square_pos(norm(myMatrix(:,1) - myMatrix*W))) + (4*norm(W)) + (10*norm(W,1)))
EDU>> subject to
EDU>> 0 <= W
EDU>> W(1,1)==0
EDU>> cvx_end
The optimization problem is solved successfully but all the variables of W meaning all the 4503 values (except W(1,1) which is 0 according to the constraint) are the exact same value.
Ex: 0
0.1338
0.1338
0.1338
0.1338
0.1338
0.1338
0.1338
......
......
This doesn't make sense because myMatrix is a sparse matrix of user/item rating information. This indicates that all users like all items equally which doesn't seem correct. I feel I am missing something here and I would appreciate any advice to help me figure out what is going on and how I can overcome this peculiar behavior.
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!