Train model using columns with arrays of uuids

DKaly: <p>SalutaHowdy.</p>
<p>I started to create a recommendation model for a project of mine, but I ran into the following problem.</p>
<p>The code is finalized but for now I make recommendations only based on price.</p>
<p>I would like to make recommendations and if I give category id or attribute id as input and my question is how can I manipulate this dataset to be able to do this</p>
<pre><code class="lang-auto">attribute_ids	category_ids	discount	price	product_id	product_name	
['a083a9e7-451c-479c-9b84-8bb523be211a', 'a0742ce3-49f8-4513-aed8-403d22c8d830', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'd01fbf0c-5609-c668-13b7-94325b465198', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'd01fbf0c-5609-c668-13b7-94325b465198', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'd01fbf0c-5609-c668-13b7-94325b465198']	4.84	6.99	201925	ChapStick Classic Original Baume Lèvres Stick 4,25g	
['a083a9e7-451c-479c-9b84-8bb523be211a']	['24c85d9c-e62f-0073-21ce-167edc6040e5', '71cc18f0-c1e7-fb65-80a7-8e7009bfd414', '921f381d-ed66-66e2-d7f7-8a97fe0acaee']	6.29	6.99	640804	Aérosol Set Adult Pour Dual Speed Eureka Care Mr. Aerosol 1 Kit	
['a083a9e7-451c-479c-9b84-8bb523be211a', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '86eee050-0fd3-aa49-a81b-90d643146f6d', 'a2278a8a-b2da-2ae7-b0b2-9b22d5b44722', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '86eee050-0fd3-aa49-a81b-90d643146f6d', 'a2278a8a-b2da-2ae7-b0b2-9b22d5b44722']	6.29	6.99	34969	Ecosym Week Forte Nettoyage Hebdomadaire Des Prothèses Dentaires 100ml	
['a083a9e7-451c-479c-9b84-8bb523be211a', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '9fe67c74-0dd0-3b7c-479a-26ede827d49d', '0be52445-95c9-73dc-7d55-332afb3eeec0', 'b963e7ec-4a95-bcc7-ac5f-6c33023dc247', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '9fe67c74-0dd0-3b7c-479a-26ede827d49d', '0be52445-95c9-73dc-7d55-332afb3eeec0', 'b963e7ec-4a95-bcc7-ac5f-6c33023dc247']	6.5	6.99	505399	Curaprox Brosse À Dents CS 5460 Ortho 1 Pièce	
['fcc76651-9066-4694-bd57-35b1d5d3a1e5', '0a3a36a4-0132-4776-a93c-3808679a24ad', '2c77565a-7660-4d41-8c13-6ea9e736a161', 'bd69d874-4f79-4e12-9485-076781e10e83']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', '3519f27c-5df7-839d-0345-dbec363c5475', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', '3519f27c-5df7-839d-0345-dbec363c5475', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', '3519f27c-5df7-839d-0345-dbec363c5475', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', '3519f27c-5df7-839d-0345-dbec363c5475']	22.8	23.99	849332	iUnik Coffret Centella Edition Skincare Gel-Crème Apaisant 60ml + Tea Tree Relief Sérum 15ml	
['a083a9e7-451c-479c-9b84-8bb523be211a', '077cf8e2-424a-4779-b3b6-3fa8090f912f']	['24c85d9c-e62f-0073-21ce-167edc6040e5', '7c825bed-464e-a821-fc80-c5a2af4a5a63', 'daae0166-dd1d-afb6-c4e9-e5558dafd423', '0a6723e7-edf3-c051-e0d9-eda9be7478db', '24c85d9c-e62f-0073-21ce-167edc6040e5', '7c825bed-464e-a821-fc80-c5a2af4a5a63', 'daae0166-dd1d-afb6-c4e9-e5558dafd423', '0a6723e7-edf3-c051-e0d9-eda9be7478db']	5.98	6.99	519999	Bsn Medical Leukoplast Professional Aqua Pro Assortiment 20 Pièces (7322106)	
['a083a9e7-451c-479c-9b84-8bb523be211a', 'abd0ffef-8262-48e8-8390-9fc29cc43d74']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', 'b5e5aa23-f4db-6959-ec6d-80c613b85be3', '40d30eb7-8082-4c92-6b33-1af88afe55bd', 'feb00124-a89b-d5c7-586f-302ca2c62aa8', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', 'b5e5aa23-f4db-6959-ec6d-80c613b85be3', '40d30eb7-8082-4c92-6b33-1af88afe55bd', 'feb00124-a89b-d5c7-586f-302ca2c62aa8']	5.57	6.99	657428	Kneipp Silky Secret Crème Douche Soin Caresse Fleur D'Arbre À Soie 200ml	
['a083a9e7-451c-479c-9b84-8bb523be211a', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', 'b7798a7a-5b35-e6bd-8715-1204693cfdbf', 'caef249c-7a3d-6ff4-7d45-f665a147aad0', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', 'b7798a7a-5b35-e6bd-8715-1204693cfdbf', 'caef249c-7a3d-6ff4-7d45-f665a147aad0']	4.89	6.99	488610	Gum Gel Dentifrice Hali Control 75ml	
['fcc76651-9066-4694-bd57-35b1d5d3a1e5', 'f52c0d68-c993-4681-ae5a-f3730e329517', 'abd0ffef-8262-48e8-8390-9fc29cc43d74', 'f58eb4a9-bbdd-4a8f-a01c-270c6786528f']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'd159976e-e722-baf2-e075-6b09b025a03e', 'f7d9920b-2f25-59f1-73ec-d99a61201e5f', '1304dd38-1924-acd5-777a-2401e9f1bb30', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'd159976e-e722-baf2-e075-6b09b025a03e', 'f7d9920b-2f25-59f1-73ec-d99a61201e5f', '1304dd38-1924-acd5-777a-2401e9f1bb30', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'd159976e-e722-baf2-e075-6b09b025a03e', 'f7d9920b-2f25-59f1-73ec-d99a61201e5f', '1304dd38-1924-acd5-777a-2401e9f1bb30', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'd159976e-e722-baf2-e075-6b09b025a03e', 'f7d9920b-2f25-59f1-73ec-d99a61201e5f', '1304dd38-1924-acd5-777a-2401e9f1bb30']	21.59	23.99	848884	Garancia Sun Protectxa0L'Eau Solaire Rouge Métamorphosante IP30 Flacon 150ml	
['a083a9e7-451c-479c-9b84-8bb523be211a']	['24c85d9c-e62f-0073-21ce-167edc6040e5', '71cc18f0-c1e7-fb65-80a7-8e7009bfd414', '921f381d-ed66-66e2-d7f7-8a97fe0acaee']	6.29	6.99	640804	Aérosol Set Adult Pour Dual Speed Eureka Care Mr. Aerosol 1 Kit	
['a083a9e7-451c-479c-9b84-8bb523be211a', 'a0742ce3-49f8-4513-aed8-403d22c8d830', '35912df9-8cdf-45ba-ab1a-5b2442b3c036', '4abba33c-31d2-4ac4-9602-d506e7d3d939']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'ca006746-3e80-58d0-ecaf-c575e61ef04c', '4826a20f-92a1-f4fe-c6ed-70eebed3d4e8', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ca006746-3e80-58d0-ecaf-c575e61ef04c', '4826a20f-92a1-f4fe-c6ed-70eebed3d4e8', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ca006746-3e80-58d0-ecaf-c575e61ef04c', '4826a20f-92a1-f4fe-c6ed-70eebed3d4e8', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ca006746-3e80-58d0-ecaf-c575e61ef04c', '4826a20f-92a1-f4fe-c6ed-70eebed3d4e8']	6.99	6.99	611937	Lilac Sensitive Skin Pain Dermatologique Surgras Pour Peaux Sèches Et Fragiles 100g	
['a083a9e7-451c-479c-9b84-8bb523be211a', 'a0742ce3-49f8-4513-aed8-403d22c8d830', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'd01fbf0c-5609-c668-13b7-94325b465198', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'd01fbf0c-5609-c668-13b7-94325b465198', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'd01fbf0c-5609-c668-13b7-94325b465198']	4.84	6.99	201925	ChapStick Classic Original Baume Lèvres Stick 4,25g	
['a083a9e7-451c-479c-9b84-8bb523be211a', '164e801f-fcbe-48ab-83ce-85a8631a07af', '6d7b2c1b-5788-43dc-89de-a492a1871867']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '68d75b5f-cfdf-9b25-771c-b09ca5ef07db', 'ce6d7d12-e05b-5f53-159c-473b84866a02', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '68d75b5f-cfdf-9b25-771c-b09ca5ef07db', 'ce6d7d12-e05b-5f53-159c-473b84866a02', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '68d75b5f-cfdf-9b25-771c-b09ca5ef07db', 'ce6d7d12-e05b-5f53-159c-473b84866a02']	4.99	6.99	510058	Hansaplast Protection Apaisantes Cors 20 Pièces	
['a083a9e7-451c-479c-9b84-8bb523be211a', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '9fe67c74-0dd0-3b7c-479a-26ede827d49d', '0be52445-95c9-73dc-7d55-332afb3eeec0', 'b963e7ec-4a95-bcc7-ac5f-6c33023dc247', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '9fe67c74-0dd0-3b7c-479a-26ede827d49d', '0be52445-95c9-73dc-7d55-332afb3eeec0', 'b963e7ec-4a95-bcc7-ac5f-6c33023dc247']	6.5	6.99	505399	Curaprox Brosse À Dents CS 5460 Ortho 1 Pièce	
['a083a9e7-451c-479c-9b84-8bb523be211a', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '9fe67c74-0dd0-3b7c-479a-26ede827d49d', '0be52445-95c9-73dc-7d55-332afb3eeec0', 'b963e7ec-4a95-bcc7-ac5f-6c33023dc247', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '9fe67c74-0dd0-3b7c-479a-26ede827d49d', '0be52445-95c9-73dc-7d55-332afb3eeec0', 'b963e7ec-4a95-bcc7-ac5f-6c33023dc247']	5.93	6.99	505394	Curaprox Brosse À Dents CS 1006 Single 1 Pièce	
['6a189ef2-ea4b-45db-b594-1157b1625479', 'b395f409-0826-434d-ba83-8e97291f6f8f', '2c77565a-7660-4d41-8c13-6ea9e736a161', 'f58eb4a9-bbdd-4a8f-a01c-270c6786528f']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51']	16.34	19.44	107524	Bioderma Sensibio (Créaline) Lait Démaquillant Peaux Sensibles Flacon 250ml	
['a083a9e7-451c-479c-9b84-8bb523be211a', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '86eee050-0fd3-aa49-a81b-90d643146f6d', '512fe991-3a05-034d-85ce-c0989e86ca61', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '86eee050-0fd3-aa49-a81b-90d643146f6d', '512fe991-3a05-034d-85ce-c0989e86ca61']	6.99	6.99	842470	Fixodent Pro Plus Dual Action Crème Adhésive Premium Pour Prothèses Dentaires 40g	
['fcc76651-9066-4694-bd57-35b1d5d3a1e5', 'f52c0d68-c993-4681-ae5a-f3730e329517', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', '0d9b9ca2-bdd8-87fc-4e2b-055f9a629f6f', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', '0d9b9ca2-bdd8-87fc-4e2b-055f9a629f6f', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', '0d9b9ca2-bdd8-87fc-4e2b-055f9a629f6f']	22.8	23.99	849340	iUnik Coffret Beta Glucan Edition Skincare 1 Set	
['a083a9e7-451c-479c-9b84-8bb523be211a', '2c77565a-7660-4d41-8c13-6ea9e736a161']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '86eee050-0fd3-aa49-a81b-90d643146f6d', 'a2278a8a-b2da-2ae7-b0b2-9b22d5b44722', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '1ee3f27e-9eec-6240-637a-d51f662abaad', '55e38db1-01f2-7096-f1d2-c138d6a00131', '86eee050-0fd3-aa49-a81b-90d643146f6d', 'a2278a8a-b2da-2ae7-b0b2-9b22d5b44722']	6.29	6.99	92169	Ecosym Gel Nettoyant Quotidien Dentaire Flacon 100ml	
['6a189ef2-ea4b-45db-b594-1157b1625479', 'b395f409-0826-434d-ba83-8e97291f6f8f', '2c77565a-7660-4d41-8c13-6ea9e736a161', 'f58eb4a9-bbdd-4a8f-a01c-270c6786528f']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'cc466221-5f55-7338-729e-21999c11038c', '24eb7d1a-7d6b-ba1d-b384-be5d7b66bea8', '830cb6e9-1af0-de34-dac1-9ff671981e51']	16.34	19.44	107524	Bioderma Sensibio (Créaline) Lait Démaquillant Peaux Sensibles Flacon 250ml	
['a083a9e7-451c-479c-9b84-8bb523be211a', '077cf8e2-424a-4779-b3b6-3fa8090f912f']	['24c85d9c-e62f-0073-21ce-167edc6040e5', '7c825bed-464e-a821-fc80-c5a2af4a5a63', 'daae0166-dd1d-afb6-c4e9-e5558dafd423', '0a6723e7-edf3-c051-e0d9-eda9be7478db', '24c85d9c-e62f-0073-21ce-167edc6040e5', '7c825bed-464e-a821-fc80-c5a2af4a5a63', 'daae0166-dd1d-afb6-c4e9-e5558dafd423', '0a6723e7-edf3-c051-e0d9-eda9be7478db']	5.98	6.99	519999	Bsn Medical Leukoplast Professional Aqua Pro Assortiment 20 Pièces (7322106)	
['a083a9e7-451c-479c-9b84-8bb523be211a', '164e801f-fcbe-48ab-83ce-85a8631a07af', '6d7b2c1b-5788-43dc-89de-a492a1871867']	['b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '68d75b5f-cfdf-9b25-771c-b09ca5ef07db', 'ce6d7d12-e05b-5f53-159c-473b84866a02', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '68d75b5f-cfdf-9b25-771c-b09ca5ef07db', 'ce6d7d12-e05b-5f53-159c-473b84866a02', 'b1287b25-f6b5-0d2d-ae11-e4ebf13665b2', '68d75b5f-cfdf-9b25-771c-b09ca5ef07db', 'ce6d7d12-e05b-5f53-159c-473b84866a02']	4.99	6.99	510058	Hansaplast Protection Apaisantes Cors 20 Pièces	
['a083a9e7-451c-479c-9b84-8bb523be211a', 'a0742ce3-49f8-4513-aed8-403d22c8d830', '35912df9-8cdf-45ba-ab1a-5b2442b3c036']	['6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', 'a762d016-8e2e-d14b-34bb-cd11d7b52c89', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', 'a762d016-8e2e-d14b-34bb-cd11d7b52c89', '6ab6fa9c-9a11-6780-c909-df61141ed234', 'ad5383f0-fadb-f867-0725-0505d89c32cc', 'a762d016-8e2e-d14b-34bb-cd11d7b52c89']	6.99	6.99	527059	Biophadine Crème Apaisante Et Nourrissante Visage Et Corps Tube 100ml	
['a083a9e7-451c-479c-9b84-8bb523be211a']	['24c85d9c-e62f-0073-21ce-167edc6040e5', '7c825bed-464e-a821-fc80-c5a2af4a5a63', 'aa6d0297-0481-b9f6-9e2c-ea72b3787371', '24aa7577-150a-dee5-6c98-45bf17124c43', '19e92132-14cc-a07e-2d63-f4b270887f89']	6.28	6.99	840437	After Bite Xtra Gel Pour Soulager Les Piqûres D'Insectes Tube 20g	
</code></pre>
<p>Below is my code</p>
<pre><code class="lang-auto">class Trainer:
    def __init__(self, num_epochs=10, batch_size=32, learning_rate=0.001):
        """
        Initialize the Trainer class with training parameters.

        :param num_epochs: Number of epochs to train the model.
        :param batch_size: Number of samples per batch to load.
        :param learning_rate: Learning rate for the optimizer.
        """
        self.recommendation_set_service = RecommendationSetService()
        self.num_epochs = num_epochs
        self.batch_size = batch_size
        self.learning_rate = learning_rate
        self.model = None

    def invoke(self):
        """
        Load data, process it, and handle the training and evaluation of the model.
        """
        recommendations_sets = self.load_data()
        processed_data = self.process_data(recommendations_sets)

        features = processed_data[["price"]]  # Only use price as feature
        targets = processed_data["price"]
        dataset = TensorDataset(
            torch.tensor(features.values, dtype=torch.float32),
            torch.tensor(targets.values, dtype=torch.float32),
        )
        data_loader = DataLoader(dataset, batch_size=self.batch_size, shuffle=True)

        input_features = features.shape[1]
        print(
            f"Number of input features: {input_features}"
        )  # Verify number of features
        print(
            f"Columns after processing in invoke: {features.columns.tolist()}"
        )  # Print columns

        self.model = PastRecommendationModel(input_features)
        criterion = nn.MSELoss()
        optimizer = torch.optim.Adam(self.model.parameters(), lr=self.learning_rate)

        self.train(self.model, data_loader, criterion, optimizer)
        self.evaluate(self.model, data_loader, criterion)

        input_price = 10

        # Generate recommendations
        test = self.recommend_products(input_price)
        print(test)

    def load_data(self):
        """
        Retrieve data from the recommendation set service.

        :return: DataFrame containing the loaded data.
        """
        raw_data = self.recommendation_set_service.get()
        return pd.DataFrame(raw_data)

    def process_data(self, data):
        """
        Process the data for training.

        :param data: The raw data to process.
        :return: DataFrame containing the processed data.
        """
        data["price"] = data["price"].astype(float)
        return data

    def train(self, model, data_loader, criterion, optimizer):
        """
        Train the model using the provided data loader and optimizer.

        :param model: The model to train.
        :param data_loader: The DataLoader containing training data.
        :param criterion: Loss function to use.
        :param optimizer: Optimizer for updating model weights.
        """
        model.train()
        for epoch in range(self.num_epochs):
            total_loss = 0
            for batch_features, batch_targets in data_loader:
                optimizer.zero_grad()
                outputs = model(batch_features)
                loss = criterion(outputs.squeeze(), batch_targets)
                loss.backward()
                optimizer.step()
                total_loss += loss.item()
            avg_loss = total_loss / len(data_loader)
            print(f"Epoch {epoch + 1}/{self.num_epochs}, Loss: {avg_loss:.4f}")

    def evaluate(self, model, data_loader, criterion):
        """
        Evaluate the model using the provided data loader and criterion.

        :param model: The model to evaluate.
        :param data_loader: The DataLoader containing evaluation data.
        :param criterion: Loss function to use.
        """
        model.eval()
        total_loss = 0
        with torch.no_grad():
            for batch_features, batch_targets in data_loader:
                outputs = model(batch_features)
                loss = criterion(outputs.squeeze(), batch_targets)
                total_loss += loss.item()
        avg_loss = total_loss / len(data_loader)
        print(f"Eval Loss: {avg_loss:.4f}")

    def recommend_products(self, input_price):
        """
        Generate product recommendations based on user input price.

        :param input_price: Target price for the recommendation.
        :return: DataFrame containing recommended products.
        """
        # Load and process all data
        all_data = self.load_data()
        processed_data = self.process_data(all_data)

        # Ensure the dimensions match by reusing process_data
        features = processed_data[["price"]]  # Only use price as feature

        print(
            f"Columns before prediction in recommend_products: {features.columns.tolist()}"
        )  # Print columns

        # Ensure the dimensions match
        input_features = features.shape[1]
        if self.model.fc1.in_features != input_features:
            print(
                f"Model expected {self.model.fc1.in_features} features, but got {input_features}"
            )
            return None

        # Predict the prices
        features_tensor = torch.tensor(features.values, dtype=torch.float32)
        predictions = self.model(features_tensor).detach().numpy().flatten()

        # Add predictions as a new column to the DataFrame
        processed_data["predicted_price"] = predictions

        # Calculate the absolute price difference from the input price
        processed_data["price_diff"] = abs(
            processed_data["predicted_price"] - input_price
        )

        # Sort products by the smallest price difference and select the top N
        recommendations = processed_data.sort_values(by="price_diff").head(2)

        return recommendations[["product_id", "product_name"]]
</code></pre>
<p>Any idea how I could proceed?</p>