From 3bdb8877a66a6b762441e4a41b28f742719294e4 Mon Sep 17 00:00:00 2001 From: Mann Patel <130435633+MannPatel0@users.noreply.github.com> Date: Sat, 12 Apr 2025 21:57:53 -0600 Subject: [PATCH] update server for recom... --- .../__pycache__/app.cpython-313.pyc | Bin 5173 -> 5732 bytes recommondation-engine/app.py | 11 +++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/recommondation-engine/__pycache__/app.cpython-313.pyc b/recommondation-engine/__pycache__/app.cpython-313.pyc index d0c168f949d69b8bef6a98623ac8c6a21666d8d0..585d78d02bba7ebf7bec25974be353f56330e8cb 100644 GIT binary patch delta 898 zcmZ9L&2JJ>5Wx2>UD&cL$VWeb3bbk~DM{6;t)*>(MQe?EL6dqgTRv8bg#~99qrEiV zw9y#)PA2*XcqY9yF}>^+`hhG_P3j+qK1>LH1|Px<6jej1RcrNf7L*!P3-!FALqEC#bVrIxB1$&A?Kd1X zJv*TyH_XMjC|Bg>Y*Fqui3``h5cIDn=}T{Nqr)d+9X_6n3m~J_wCC%fSHTo&P|^(3 zq25>XbwfpawNfb=al2`+W4%jhQ%C`1ADH$+PRUm_2(#BcB}1*4PDbTkwp>?rJDOwG z>6RZVsAbhq6_!K+mA;Z(5*)>#LA?4Jt@wg=S&%;kg7k@RD81aeskD|?S}VC$zS7ER zEv?oH-+k|bZxYuR+IMrko@er7`KjmUzDNZ5qv-1BF3j{IMN$!NH^QezY)wBOwK=T< z;V}B>f-vfUVU!?DbzxITqB!2LU$m#1B+P`gNw{1FmBRS-w$$#D*n0B0<&I1m||Tk8HTDG z(8FwOi>!6DrV8CAnT_?-P4?eLi?bEn;<7pqw=jh5rap_R-T&CGYcR9=_k<5(=L$Wz?e z>Ap)2<2krBoV%V5FB#Ly9l+R9Xj;K|7tF};`R_=*dfTyB)oR%`e+hL6@z2m0eb7=9 zNfB%h&~;Gg>;Y>JJjS>5*{}$9R+??c#u=VAo&=7_PU+DrhplqOCQR6>@JBjgFw zqlb|UTr5c2j0%0=GHmubxS!r;2nPrU3A2PbLYZI^4iOF$D*R)#5&zb12yo6@Jnx~C<+PXNF;s6cj8IklmrHkA0LQrOmX c$Zuy#kle0A(I-IYhmnVCFs|hxi)s1y5Aq_c+yDRo diff --git a/recommondation-engine/app.py b/recommondation-engine/app.py index dfd8ff2..39afd3d 100644 --- a/recommondation-engine/app.py +++ b/recommondation-engine/app.py @@ -107,19 +107,14 @@ def get_user_history(user_id): db_con.close() return final - -def delete_user_recommendations(userId): - pass - - def get_recommendations(user_id, top_n=10): try: # Get all products and user history with their category vectors all_products = get_all_products() user_history = get_user_history(user_id) - if not user_history: - #Cold start: return popular products - return get_popular_products(top_n) + # if not user_history: + # #Cold start: return popular products + # return get_popular_products(top_n) # Calculate similarity between all products and user history user_profile = np.mean(user_history, axis=0) # Average user preferences similarities = cosine_similarity([user_profile], all_products)